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, shell=True): # 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, + script, shell=shell, env=env, close_fds=True, creationflags=_creationflags) else: - def runshellcommand(script, env): + def runshellcommand(script, env, shell=True): # double-fork to completely detach from the parent process # based on http://code.activestate.com/recipes/278731 pid = os.fork() @@ -82,7 +82,7 @@ # connect stdin to devnull to make sure the subprocess can't # muck up that stream for mercurial. subprocess.Popen( - script, shell=True, stdin=open(os.devnull, 'r'), env=env, + script, shell=shell, stdin=open(os.devnull, 'r'), env=env, close_fds=True, **newsession) finally: # mission accomplished, this child needs to exit and not @@ -124,7 +124,8 @@ env = dict(itertools.chain(encoding.environ.items(), msgpairs, optpairs), EVENT=event, HGPID=str(os.getpid())) - runshellcommand(script, env) + shell = self.configbool('logtoprocess', 'shell') + runshellcommand(script, env, shell) return super(logtoprocessui, self).log(event, *msg, **opts) # Replace the class for this instance and all clones created from it: diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -566,6 +566,9 @@ coreconfigitem('logtoprocess', 'develwarn', default=None, ) +coreconfigitem('logtoprocess', 'shell', + default=True, +) coreconfigitem('logtoprocess', 'uiblocked', default=None, )