mercurial/utils/procutil.py
changeset 39662 50f46b771921
parent 38526 313a940d49a3
child 39826 c31ce080eb75
--- a/mercurial/utils/procutil.py	Sat Sep 15 10:35:00 2018 +0900
+++ b/mercurial/utils/procutil.py	Sat Sep 15 13:31:41 2018 -0400
@@ -320,10 +320,19 @@
 if pycompat.iswindows:
     def shelltonative(cmd, env):
         return platform.shelltocmdexe(cmd, shellenviron(env))
+
+    tonativestr = encoding.strfromlocal
 else:
     def shelltonative(cmd, env):
         return cmd
 
+    tonativestr = pycompat.identity
+
+def tonativeenv(env):
+    '''convert the environment from bytes to strings suitable for Popen(), etc.
+    '''
+    return pycompat.rapply(tonativestr, env)
+
 def system(cmd, environ=None, cwd=None, out=None):
     '''enhanced shell command execution.
     run with environment maybe modified, maybe in different dir.