Patchwork D1700: logtoprocess: pass ui in runshellcommand

login
register
mail settings
Submitter phabricator
Date Dec. 15, 2017, 10:10 a.m.
Message ID <differential-rev-PHID-DREV-4z45sb4avqcd7few7pya-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/26297/
State New
Headers show

Comments

phabricator - Dec. 15, 2017, 10:10 a.m.
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




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

Patch

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: