D1700: logtoprocess: pass ui in runshellcommand

lothiraldan (Boris Feld) phabricator at mercurial-scm.org
Fri Dec 15 10:10:57 UTC 2017


lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  We are gonna read a configuration specific to Windows, instead of adding a
  useless arguments for runshellcommand on linux, pass the ui object to read it
  directly.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/logtoprocess.py

CHANGE DETAILS

diff --git a/hgext/logtoprocess.py b/hgext/logtoprocess.py
--- a/hgext/logtoprocess.py
+++ b/hgext/logtoprocess.py
@@ -58,14 +58,14 @@
         DETACHED_PROCESS = 0x00000008
         _creationflags = DETACHED_PROCESS | subprocess.CREATE_NEW_PROCESS_GROUP
 
-        def runshellcommand(script, env):
+        def runshellcommand(script, env, ui):
             # we can't use close_fds *and* redirect stdin. I'm not sure that we
             # need to because the detached process has no console connection.
             subprocess.Popen(
                 script, shell=True, env=env, close_fds=True,
                 creationflags=_creationflags)
     else:
-        def runshellcommand(script, env):
+        def runshellcommand(script, env, ui):
             # double-fork to completely detach from the parent process
             # based on http://code.activestate.com/recipes/278731
             pid = os.fork()
@@ -124,7 +124,7 @@
                 env = dict(itertools.chain(encoding.environ.items(),
                                            msgpairs, optpairs),
                            EVENT=event, HGPID=str(os.getpid()))
-                runshellcommand(script, env)
+                runshellcommand(script, env, self)
             return super(logtoprocessui, self).log(event, *msg, **opts)
 
     # Replace the class for this instance and all clones created from it:



To: lothiraldan, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list