hgext/logtoprocess.py
changeset 39841 f1d6021453c2
parent 39831 c31ce080eb75
child 39890 566cc633e637
equal deleted inserted replaced
39840:91d63fd58e7d 39841:f1d6021453c2
    64 
    64 
    65         def runshellcommand(script, env):
    65         def runshellcommand(script, env):
    66             # we can't use close_fds *and* redirect stdin. I'm not sure that we
    66             # we can't use close_fds *and* redirect stdin. I'm not sure that we
    67             # need to because the detached process has no console connection.
    67             # need to because the detached process has no console connection.
    68             subprocess.Popen(
    68             subprocess.Popen(
    69                 pycompat.rapply(procutil.tonativestr, script),
    69                 procutil.tonativestr(script),
    70                 shell=True, env=procutil.tonativeenv(env), close_fds=True,
    70                 shell=True, env=procutil.tonativeenv(env), close_fds=True,
    71                 creationflags=_creationflags)
    71                 creationflags=_creationflags)
    72     else:
    72     else:
    73         def runshellcommand(script, env):
    73         def runshellcommand(script, env):
    74             # double-fork to completely detach from the parent process
    74             # double-fork to completely detach from the parent process
    85                 newsession = {'start_new_session': True}
    85                 newsession = {'start_new_session': True}
    86             try:
    86             try:
    87                 # connect stdin to devnull to make sure the subprocess can't
    87                 # connect stdin to devnull to make sure the subprocess can't
    88                 # muck up that stream for mercurial.
    88                 # muck up that stream for mercurial.
    89                 subprocess.Popen(
    89                 subprocess.Popen(
    90                     pycompat.rapply(procutil.tonativestr, script),
    90                     procutil.tonativestr(script),
    91                     shell=True, stdin=open(os.devnull, 'r'),
    91                     shell=True, stdin=open(os.devnull, 'r'),
    92                     env=procutil.tonativeenv(env),
    92                     env=procutil.tonativeenv(env),
    93                     close_fds=True, **newsession)
    93                     close_fds=True, **newsession)
    94             finally:
    94             finally:
    95                 # mission accomplished, this child needs to exit and not
    95                 # mission accomplished, this child needs to exit and not