mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
Fix subprocess encoding
This commit is contained in:
@@ -77,6 +77,8 @@ def which(*args, **kwargs):
|
||||
|
||||
|
||||
def handle_parsed_args(parsed):
|
||||
if "PIPENV_VERBOSITY" in os.environ:
|
||||
parsed.verbose = int(os.getenv("PIPENV_VERBOSITY"))
|
||||
if parsed.debug:
|
||||
parsed.verbose = max(parsed.verbose, 2)
|
||||
if parsed.verbose > 1:
|
||||
|
||||
+6
-4
@@ -2264,16 +2264,18 @@ def interrupt_handled_subprocess(
|
||||
|
||||
def subprocess_run(
|
||||
args, *, block=True, text=True, capture_output=True,
|
||||
encoding=DEFAULT_ENCODING, env=None, **other_kwargs
|
||||
encoding="utf-8", env=None, **other_kwargs
|
||||
):
|
||||
"""A backward compatible version of subprocess.run().
|
||||
|
||||
It outputs text with default encoding, and store all outputs in the returned object instead of
|
||||
printing onto stdout.
|
||||
"""
|
||||
if env is not None:
|
||||
env = dict(os.environ, **env)
|
||||
other_kwargs['env'] = env
|
||||
_env = os.environ.copy()
|
||||
_env["PYTHONIOENCODING"] = encoding
|
||||
if env:
|
||||
_env.update(env)
|
||||
other_kwargs["env"] = _env
|
||||
if capture_output:
|
||||
other_kwargs['stdout'] = subprocess.PIPE
|
||||
other_kwargs['stderr'] = subprocess.PIPE
|
||||
|
||||
Vendored
+3
-2
@@ -762,10 +762,11 @@ def shim_unpack(
|
||||
unpack_kwargs["only_download"] = only_download
|
||||
if session is not None and "session" in required_args:
|
||||
unpack_kwargs["session"] = session
|
||||
if "downloader" in required_args and downloader_provider is not None:
|
||||
if downloader_provider is not None and any(arg in required_args for arg in ("download", "downloader")):
|
||||
assert session is not None
|
||||
assert progress_bar is not None
|
||||
unpack_kwargs["downloader"] = downloader_provider(session, progress_bar)
|
||||
arg = {"download", "downloader"}.intersection(required_args).pop()
|
||||
unpack_kwargs[arg] = downloader_provider(session, progress_bar)
|
||||
return unpack_fn(**unpack_kwargs) # type: ignore
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user