changeset 30737:2957409449ac

chgserver: use util.shellenviron This avoids code duplication.
author Jun Wu <quark@fb.com>
date Tue, 10 Jan 2017 06:58:51 +0800
parents d9e5b0aeeb90
children a45c0f42271f
files mercurial/chgserver.py
diffstat 1 files changed, 1 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/chgserver.py	Tue Jan 10 06:58:02 2017 +0800
+++ b/mercurial/chgserver.py	Tue Jan 10 06:58:51 2017 +0800
@@ -231,19 +231,8 @@
                 or self.fout.fileno() != util.stdout.fileno()):
                 return super(chgui, self).system(cmd, environ, cwd, onerr,
                                                  errprefix)
-            # copied from mercurial/util.py:system()
             self.flush()
-            def py2shell(val):
-                if val is None or val is False:
-                    return '0'
-                if val is True:
-                    return '1'
-                return str(val)
-            env = encoding.environ.copy()
-            if environ:
-                env.update((k, py2shell(v)) for k, v in environ.iteritems())
-            env['HG'] = util.hgexecutable()
-            rc = self._csystem(cmd, env, cwd)
+            rc = self._csystem(cmd, util.shellenviron(environ), cwd)
             if rc and onerr:
                 errmsg = '%s %s' % (os.path.basename(cmd.split(None, 1)[0]),
                                     util.explainexit(rc)[0])