We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
AttributeError: 'NoneType' object has no attribute 'split'
### Describe the bug

When I try to log into my account with the token via `huggingface-cli login`, I get this error:
```
Exception in thread Thread-1 (_readerthread):
Traceback (most recent call last):
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\threading.py", line 946, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1494, in _readerthread
    buffer.append(fh.read())
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xee in position 387: invalid continuation byte
Traceback (most recent call last):
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\Scripts\huggingface-cli.exe\__main__.py", line 7, in <module>
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\site-packages\huggingface_hub\commands\huggingface_cli.py", line 47, in main
    service.run()
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\site-packages\huggingface_hub\commands\user.py", line 117, in run
    login()
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\site-packages\huggingface_hub\_login.py", line 91, in login
    interpreter_login()
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\site-packages\huggingface_hub\_login.py", line 137, in interpreter_login
    _login(token=token, add_to_git_credential=add_to_git_credential)
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\site-packages\huggingface_hub\_login.py", line 231, in _login
    if _is_git_credential_helper_configured():
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\site-packages\huggingface_hub\_login.py", line 251, in _is_git_credential_helper_configured
    helpers = list_credential_helpers()
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\site-packages\huggingface_hub\utils\_git_credential.py", line 44, in list_credential_helpers
    for line in output.split("\n")
AttributeError: 'NoneType' object has no attribute 'split'
```
Also, when using `huggingface-cli env`, I got this error. I dunno if it's related, but here it is anyway:
```
Exception in thread Thread-1 (_readerthread):
Traceback (most recent call last):
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\threading.py", line 946, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1494, in _readerthread
    buffer.append(fh.read())
  File "C:\Users\mikwee\AppData\Local\Programs\Python\Python310\lib\codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xee in position 387: invalid continuation byte
```

### Reproduction

The commands I've used:
```
git clone https://github.com/harishanand95/diffusers.git
cd diffusers && git checkout dml && pip install -e .
pip install transformers ftfy scipy
pip install ort_nightly_directml-1.13.0.dev20220901005-cp310-cp310-win_amd64.whl
cd ./diffusers/examples/inference
huggingface-cli login
```

### Logs

_No response_

### System info

```shell
- huggingface_hub version: 0.11.0
- Platform: Windows-10-10.0.19044-SP0
- Python version: 3.10.4
- Running in iPython ?: No
- Running in notebook ?: No
- Running in Google Colab ?: No
- Token path ?: C:\Users\mikwee\.huggingface\token
- Has saved token ?: False
- FastAI: N/A
- Tensorflow: N/A
- Torch: 1.13.0
- Jinja2: N/A
- Graphviz: N/A
- Pydot: N/A
```


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/huggingface_hub/utils/_subprocess.py`
Content:
```
1 #!/usr/bin/env python
2 # coding=utf-8
3 # Copyright 2021 The HuggingFace Inc. team. All rights reserved.
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #     http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License
16 """Contains utilities to easily handle subprocesses in `huggingface_hub`."""
17 import os
18 import subprocess
19 from contextlib import contextmanager
20 from pathlib import Path
21 from typing import IO, Generator, List, Optional, Tuple, Union
22 
23 from .logging import get_logger
24 
25 
26 logger = get_logger(__name__)
27 
28 
29 def run_subprocess(
30     command: Union[str, List[str]],
31     folder: Optional[Union[str, Path]] = None,
32     check=True,
33     **kwargs,
34 ) -> subprocess.CompletedProcess:
35     """
36     Method to run subprocesses. Calling this will capture the `stderr` and `stdout`,
37     please call `subprocess.run` manually in case you would like for them not to
38     be captured.
39 
40     Args:
41         command (`str` or `List[str]`):
42             The command to execute as a string or list of strings.
43         folder (`str`, *optional*):
44             The folder in which to run the command. Defaults to current working
45             directory (from `os.getcwd()`).
46         check (`bool`, *optional*, defaults to `True`):
47             Setting `check` to `True` will raise a `subprocess.CalledProcessError`
48             when the subprocess has a non-zero exit code.
49         kwargs (`Dict[str]`):
50             Keyword arguments to be passed to the `subprocess.run` underlying command.
51 
52     Returns:
53         `subprocess.CompletedProcess`: The completed process.
54     """
55     if isinstance(command, str):
56         command = command.split()
57 
58     if isinstance(folder, Path):
59         folder = str(folder)
60 
61     return subprocess.run(
62         command,
63         stderr=subprocess.PIPE,
64         stdout=subprocess.PIPE,
65         check=check,
66         encoding="utf-8",
67         cwd=folder or os.getcwd(),
68         **kwargs,
69     )
70 
71 
72 @contextmanager
73 def run_interactive_subprocess(
74     command: Union[str, List[str]],
75     folder: Optional[Union[str, Path]] = None,
76     **kwargs,
77 ) -> Generator[Tuple[IO[str], IO[str]], None, None]:
78     """Run a subprocess in an interactive mode in a context manager.
79 
80     Args:
81         command (`str` or `List[str]`):
82             The command to execute as a string or list of strings.
83         folder (`str`, *optional*):
84             The folder in which to run the command. Defaults to current working
85             directory (from `os.getcwd()`).
86         kwargs (`Dict[str]`):
87             Keyword arguments to be passed to the `subprocess.run` underlying command.
88 
89     Returns:
90         `Tuple[IO[str], IO[str]]`: A tuple with `stdin` and `stdout` to interact
91         with the process (input and output are utf-8 encoded).
92 
93     Example:
94     ```python
95     with _interactive_subprocess("git credential-store get") as (stdin, stdout):
96         # Write to stdin
97         stdin.write("url=hf.co\nusername=obama\n".encode("utf-8"))
98         stdin.flush()
99 
100         # Read from stdout
101         output = stdout.read().decode("utf-8")
102     ```
103     """
104     if isinstance(command, str):
105         command = command.split()
106 
107     with subprocess.Popen(
108         command,
109         stdin=subprocess.PIPE,
110         stdout=subprocess.PIPE,
111         stderr=subprocess.STDOUT,
112         encoding="utf-8",
113         cwd=folder or os.getcwd(),
114         **kwargs,
115     ) as process:
116         assert process.stdin is not None, "subprocess is opened as subprocess.PIPE"
117         assert process.stdout is not None, "subprocess is opened as subprocess.PIPE"
118         yield process.stdin, process.stdout
119
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/huggingface_hub/utils/_subprocess.py b/src/huggingface_hub/utils/_subprocess.py
--- a/src/huggingface_hub/utils/_subprocess.py
+++ b/src/huggingface_hub/utils/_subprocess.py
@@ -64,6 +64,7 @@
         stdout=subprocess.PIPE,
         check=check,
         encoding="utf-8",
+        errors="replace",  # if not utf-8, replace char by �
         cwd=folder or os.getcwd(),
         **kwargs,
     )
@@ -110,6 +111,7 @@
         stdout=subprocess.PIPE,
         stderr=subprocess.STDOUT,
         encoding="utf-8",
+        errors="replace",  # if not utf-8, replace char by �
         cwd=folder or os.getcwd(),
         **kwargs,
     ) as process:

{"golden_diff": "diff --git a/src/huggingface_hub/utils/_subprocess.py b/src/huggingface_hub/utils/_subprocess.py\n--- a/src/huggingface_hub/utils/_subprocess.py\n+++ b/src/huggingface_hub/utils/_subprocess.py\n@@ -64,6 +64,7 @@\n         stdout=subprocess.PIPE,\n         check=check,\n         encoding=\"utf-8\",\n+        errors=\"replace\",  # if not utf-8, replace char by \ufffd\n         cwd=folder or os.getcwd(),\n         **kwargs,\n     )\n@@ -110,6 +111,7 @@\n         stdout=subprocess.PIPE,\n         stderr=subprocess.STDOUT,\n         encoding=\"utf-8\",\n+        errors=\"replace\",  # if not utf-8, replace char by \ufffd\n         cwd=folder or os.getcwd(),\n         **kwargs,\n     ) as process:\n", "issue": "AttributeError: 'NoneType' object has no attribute 'split'\n### Describe the bug\r\n\r\nWhen I try to log into my account with the token via `huggingface-cli login`, I get this error:\r\n```\r\nException in thread Thread-1 (_readerthread):\r\nTraceback (most recent call last):\r\n  File \"C:\\Users\\mikwee\\AppData\\Local\\Programs\\Python\\Python310\\lib\\threading.py\", line 1009, in _bootstrap_inner\r\n    self.run()\r\n  File \"C:\\Users\\mikwee\\AppData\\Local\\Programs\\Python\\Python310\\lib\\threading.py\", line 946, in run\r\n    self._target(*self._args, **self._kwargs)\r\n  File \"C:\\Users\\mikwee\\AppData\\Local\\Programs\\Python\\Python310\\lib\\subprocess.py\", line 1494, in _readerthread\r\n    buffer.append(fh.read())\r\n  File \"C:\\Users\\mikwee\\AppData\\Local\\Programs\\Python\\Python310\\lib\\codecs.py\", line 322, in decode\r\n    (result, consumed) = self._buffer_decode(data, self.errors, final)\r\nUnicodeDecodeError: 'utf-8' codec can't decode byte 0xee in position 387: invalid continuation byte\r\nTraceback (most recent call last):\r\n  File \"C:\\Users\\mikwee\\AppData\\Local\\Programs\\Python\\Python310\\lib\\runpy.py\", line 196, in _run_module_as_main\r\n    return _run_code(code, main_globals, None,\r\n  File \"C:\\Users\\mikwee\\AppData\\Local\\Programs\\Python\\Python310\\lib\\runpy.py\", line 86, in _run_code\r\n    exec(code, run_globals)\r\n  File \"C:\\Users\\mikwee\\AppData\\Local\\Programs\\Python\\Python310\\Scripts\\huggingface-cli.exe\\__main__.py\", line 7, in <module>\r\n  File \"C:\\Users\\mikwee\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\huggingface_hub\\commands\\huggingface_cli.py\", line 47, in main\r\n    service.run()\r\n  File \"C:\\Users\\mikwee\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\huggingface_hub\\commands\\user.py\", line 117, in run\r\n    login()\r\n  File \"C:\\Users\\mikwee\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\huggingface_hub\\_login.py\", line 91, in login\r\n    interpreter_login()\r\n  File \"C:\\Users\\mikwee\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\huggingface_hub\\_login.py\", line 137, in interpreter_login\r\n    _login(token=token, add_to_git_credential=add_to_git_credential)\r\n  File \"C:\\Users\\mikwee\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\huggingface_hub\\_login.py\", line 231, in _login\r\n    if _is_git_credential_helper_configured():\r\n  File \"C:\\Users\\mikwee\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\huggingface_hub\\_login.py\", line 251, in _is_git_credential_helper_configured\r\n    helpers = list_credential_helpers()\r\n  File \"C:\\Users\\mikwee\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\huggingface_hub\\utils\\_git_credential.py\", line 44, in list_credential_helpers\r\n    for line in output.split(\"\\n\")\r\nAttributeError: 'NoneType' object has no attribute 'split'\r\n```\r\nAlso, when using `huggingface-cli env`, I got this error. I dunno if it's related, but here it is anyway:\r\n```\r\nException in thread Thread-1 (_readerthread):\r\nTraceback (most recent call last):\r\n  File \"C:\\Users\\mikwee\\AppData\\Local\\Programs\\Python\\Python310\\lib\\threading.py\", line 1009, in _bootstrap_inner\r\n    self.run()\r\n  File \"C:\\Users\\mikwee\\AppData\\Local\\Programs\\Python\\Python310\\lib\\threading.py\", line 946, in run\r\n    self._target(*self._args, **self._kwargs)\r\n  File \"C:\\Users\\mikwee\\AppData\\Local\\Programs\\Python\\Python310\\lib\\subprocess.py\", line 1494, in _readerthread\r\n    buffer.append(fh.read())\r\n  File \"C:\\Users\\mikwee\\AppData\\Local\\Programs\\Python\\Python310\\lib\\codecs.py\", line 322, in decode\r\n    (result, consumed) = self._buffer_decode(data, self.errors, final)\r\nUnicodeDecodeError: 'utf-8' codec can't decode byte 0xee in position 387: invalid continuation byte\r\n```\r\n\r\n### Reproduction\r\n\r\nThe commands I've used:\r\n```\r\ngit clone https://github.com/harishanand95/diffusers.git\r\ncd diffusers && git checkout dml && pip install -e .\r\npip install transformers ftfy scipy\r\npip install ort_nightly_directml-1.13.0.dev20220901005-cp310-cp310-win_amd64.whl\r\ncd ./diffusers/examples/inference\r\nhuggingface-cli login\r\n```\r\n\r\n### Logs\r\n\r\n_No response_\r\n\r\n### System info\r\n\r\n```shell\r\n- huggingface_hub version: 0.11.0\r\n- Platform: Windows-10-10.0.19044-SP0\r\n- Python version: 3.10.4\r\n- Running in iPython ?: No\r\n- Running in notebook ?: No\r\n- Running in Google Colab ?: No\r\n- Token path ?: C:\\Users\\mikwee\\.huggingface\\token\r\n- Has saved token ?: False\r\n- FastAI: N/A\r\n- Tensorflow: N/A\r\n- Torch: 1.13.0\r\n- Jinja2: N/A\r\n- Graphviz: N/A\r\n- Pydot: N/A\r\n```\r\n\n", "before_files": [{"content": "#!/usr/bin/env python\n# coding=utf-8\n# Copyright 2021 The HuggingFace Inc. team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License\n\"\"\"Contains utilities to easily handle subprocesses in `huggingface_hub`.\"\"\"\nimport os\nimport subprocess\nfrom contextlib import contextmanager\nfrom pathlib import Path\nfrom typing import IO, Generator, List, Optional, Tuple, Union\n\nfrom .logging import get_logger\n\n\nlogger = get_logger(__name__)\n\n\ndef run_subprocess(\n    command: Union[str, List[str]],\n    folder: Optional[Union[str, Path]] = None,\n    check=True,\n    **kwargs,\n) -> subprocess.CompletedProcess:\n    \"\"\"\n    Method to run subprocesses. Calling this will capture the `stderr` and `stdout`,\n    please call `subprocess.run` manually in case you would like for them not to\n    be captured.\n\n    Args:\n        command (`str` or `List[str]`):\n            The command to execute as a string or list of strings.\n        folder (`str`, *optional*):\n            The folder in which to run the command. Defaults to current working\n            directory (from `os.getcwd()`).\n        check (`bool`, *optional*, defaults to `True`):\n            Setting `check` to `True` will raise a `subprocess.CalledProcessError`\n            when the subprocess has a non-zero exit code.\n        kwargs (`Dict[str]`):\n            Keyword arguments to be passed to the `subprocess.run` underlying command.\n\n    Returns:\n        `subprocess.CompletedProcess`: The completed process.\n    \"\"\"\n    if isinstance(command, str):\n        command = command.split()\n\n    if isinstance(folder, Path):\n        folder = str(folder)\n\n    return subprocess.run(\n        command,\n        stderr=subprocess.PIPE,\n        stdout=subprocess.PIPE,\n        check=check,\n        encoding=\"utf-8\",\n        cwd=folder or os.getcwd(),\n        **kwargs,\n    )\n\n\n@contextmanager\ndef run_interactive_subprocess(\n    command: Union[str, List[str]],\n    folder: Optional[Union[str, Path]] = None,\n    **kwargs,\n) -> Generator[Tuple[IO[str], IO[str]], None, None]:\n    \"\"\"Run a subprocess in an interactive mode in a context manager.\n\n    Args:\n        command (`str` or `List[str]`):\n            The command to execute as a string or list of strings.\n        folder (`str`, *optional*):\n            The folder in which to run the command. Defaults to current working\n            directory (from `os.getcwd()`).\n        kwargs (`Dict[str]`):\n            Keyword arguments to be passed to the `subprocess.run` underlying command.\n\n    Returns:\n        `Tuple[IO[str], IO[str]]`: A tuple with `stdin` and `stdout` to interact\n        with the process (input and output are utf-8 encoded).\n\n    Example:\n    ```python\n    with _interactive_subprocess(\"git credential-store get\") as (stdin, stdout):\n        # Write to stdin\n        stdin.write(\"url=hf.co\\nusername=obama\\n\".encode(\"utf-8\"))\n        stdin.flush()\n\n        # Read from stdout\n        output = stdout.read().decode(\"utf-8\")\n    ```\n    \"\"\"\n    if isinstance(command, str):\n        command = command.split()\n\n    with subprocess.Popen(\n        command,\n        stdin=subprocess.PIPE,\n        stdout=subprocess.PIPE,\n        stderr=subprocess.STDOUT,\n        encoding=\"utf-8\",\n        cwd=folder or os.getcwd(),\n        **kwargs,\n    ) as process:\n        assert process.stdin is not None, \"subprocess is opened as subprocess.PIPE\"\n        assert process.stdout is not None, \"subprocess is opened as subprocess.PIPE\"\n        yield process.stdin, process.stdout\n", "path": "src/huggingface_hub/utils/_subprocess.py"}], "after_files": [{"content": "#!/usr/bin/env python\n# coding=utf-8\n# Copyright 2021 The HuggingFace Inc. team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License\n\"\"\"Contains utilities to easily handle subprocesses in `huggingface_hub`.\"\"\"\nimport os\nimport subprocess\nfrom contextlib import contextmanager\nfrom pathlib import Path\nfrom typing import IO, Generator, List, Optional, Tuple, Union\n\nfrom .logging import get_logger\n\n\nlogger = get_logger(__name__)\n\n\ndef run_subprocess(\n    command: Union[str, List[str]],\n    folder: Optional[Union[str, Path]] = None,\n    check=True,\n    **kwargs,\n) -> subprocess.CompletedProcess:\n    \"\"\"\n    Method to run subprocesses. Calling this will capture the `stderr` and `stdout`,\n    please call `subprocess.run` manually in case you would like for them not to\n    be captured.\n\n    Args:\n        command (`str` or `List[str]`):\n            The command to execute as a string or list of strings.\n        folder (`str`, *optional*):\n            The folder in which to run the command. Defaults to current working\n            directory (from `os.getcwd()`).\n        check (`bool`, *optional*, defaults to `True`):\n            Setting `check` to `True` will raise a `subprocess.CalledProcessError`\n            when the subprocess has a non-zero exit code.\n        kwargs (`Dict[str]`):\n            Keyword arguments to be passed to the `subprocess.run` underlying command.\n\n    Returns:\n        `subprocess.CompletedProcess`: The completed process.\n    \"\"\"\n    if isinstance(command, str):\n        command = command.split()\n\n    if isinstance(folder, Path):\n        folder = str(folder)\n\n    return subprocess.run(\n        command,\n        stderr=subprocess.PIPE,\n        stdout=subprocess.PIPE,\n        check=check,\n        encoding=\"utf-8\",\n        errors=\"replace\",  # if not utf-8, replace char by \ufffd\n        cwd=folder or os.getcwd(),\n        **kwargs,\n    )\n\n\n@contextmanager\ndef run_interactive_subprocess(\n    command: Union[str, List[str]],\n    folder: Optional[Union[str, Path]] = None,\n    **kwargs,\n) -> Generator[Tuple[IO[str], IO[str]], None, None]:\n    \"\"\"Run a subprocess in an interactive mode in a context manager.\n\n    Args:\n        command (`str` or `List[str]`):\n            The command to execute as a string or list of strings.\n        folder (`str`, *optional*):\n            The folder in which to run the command. Defaults to current working\n            directory (from `os.getcwd()`).\n        kwargs (`Dict[str]`):\n            Keyword arguments to be passed to the `subprocess.run` underlying command.\n\n    Returns:\n        `Tuple[IO[str], IO[str]]`: A tuple with `stdin` and `stdout` to interact\n        with the process (input and output are utf-8 encoded).\n\n    Example:\n    ```python\n    with _interactive_subprocess(\"git credential-store get\") as (stdin, stdout):\n        # Write to stdin\n        stdin.write(\"url=hf.co\\nusername=obama\\n\".encode(\"utf-8\"))\n        stdin.flush()\n\n        # Read from stdout\n        output = stdout.read().decode(\"utf-8\")\n    ```\n    \"\"\"\n    if isinstance(command, str):\n        command = command.split()\n\n    with subprocess.Popen(\n        command,\n        stdin=subprocess.PIPE,\n        stdout=subprocess.PIPE,\n        stderr=subprocess.STDOUT,\n        encoding=\"utf-8\",\n        errors=\"replace\",  # if not utf-8, replace char by \ufffd\n        cwd=folder or os.getcwd(),\n        **kwargs,\n    ) as process:\n        assert process.stdin is not None, \"subprocess is opened as subprocess.PIPE\"\n        assert process.stdout is not None, \"subprocess is opened as subprocess.PIPE\"\n        yield process.stdin, process.stdout\n", "path": "src/huggingface_hub/utils/_subprocess.py"}]}