hgext/logtoprocess.py
changeset 39926 c4a3d3c67c4f
parent 39885 566cc633e637
child 40401 6bd477ee7294
equal deleted inserted replaced
39925:dfca83594145 39926:c4a3d3c67c4f
    81             if sys.version_info < (3, 2):
    81             if sys.version_info < (3, 2):
    82                 newsession = {'preexec_fn': os.setsid}
    82                 newsession = {'preexec_fn': os.setsid}
    83             else:
    83             else:
    84                 newsession = {'start_new_session': True}
    84                 newsession = {'start_new_session': True}
    85             try:
    85             try:
    86                 # connect stdin to devnull to make sure the subprocess can't
    86                 # connect std* to devnull to make sure the subprocess can't
    87                 # muck up that stream for mercurial.
    87                 # muck up these stream for mercurial.
       
    88                 # Connect all the streams to be more close to Windows behavior
       
    89                 # and pager will wait for scripts to end if we don't do that
       
    90                 nullrfd = open(os.devnull, 'r')
       
    91                 nullwfd = open(os.devnull, 'w')
    88                 subprocess.Popen(
    92                 subprocess.Popen(
    89                     procutil.tonativestr(script),
    93                     procutil.tonativestr(script),
    90                     shell=True, stdin=open(os.devnull, 'r'),
    94                     shell=True, stdin=nullrfd,
       
    95                     stdout=nullwfd, stderr=nullwfd,
    91                     env=procutil.tonativeenv(env),
    96                     env=procutil.tonativeenv(env),
    92                     close_fds=True, **newsession)
    97                     close_fds=True, **newsession)
    93             finally:
    98             finally:
    94                 # mission accomplished, this child needs to exit and not
    99                 # mission accomplished, this child needs to exit and not
    95                 # continue the hg process here.
   100                 # continue the hg process here.