Patchwork D9471: procutil: correctly convert to bytes when shell=False

login
register
mail settings
Submitter phabricator
Date Dec. 1, 2020, 6:18 a.m.
Message ID <differential-rev-PHID-DREV-7gb5rf3tddib75pzvq5y-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47749/
State Superseded
Headers show

Comments

phabricator - Dec. 1, 2020, 6:18 a.m.
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9471

AFFECTED FILES
  mercurial/utils/procutil.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py
--- a/mercurial/utils/procutil.py
+++ b/mercurial/utils/procutil.py
@@ -654,9 +654,13 @@ 
                 stdin.write(stdin_bytes)
                 stdin.flush()
                 stdin.seek(0)
+            if shell:
+                script = tonativestr(script)
+            else:
+                script = [tonativestr(s) for s in script]
 
             p = subprocess.Popen(
-                tonativestr(script),
+                script,
                 shell=shell,
                 env=tonativeenv(env),
                 close_fds=True,