comparison mercurial/utils/procutil.py @ 53033:7a4772e92f23 stable

procutil: fix passing of stdin_bytes to background command When the command where run in the background, the std was closed. So we have to so do some file description juggling to make sure it is passed down. This was affecting automatic clone bundle generation and associated test was added.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 06 Mar 2025 12:23:27 +0100
parents 24ee91ba9aa8
children
comparison
equal deleted inserted replaced
53032:c3e450bfdf34 53033:7a4772e92f23
741 if isinstance(cmd, bytes): 741 if isinstance(cmd, bytes):
742 cmd = [cmd] 742 cmd = [cmd]
743 script = b' '.join(shellquote(x) for x in cmd) 743 script = b' '.join(shellquote(x) for x in cmd)
744 if record_wait is None: 744 if record_wait is None:
745 # double-fork to completely detach from the parent process 745 # double-fork to completely detach from the parent process
746 script = b'( %s ) &' % script 746 script = b'( ( %s ) <&3 3<&- &) 3<&0' % script
747 start_new_session = True 747 start_new_session = True
748 else: 748 else:
749 start_new_session = False 749 start_new_session = False
750 ensurestart = True 750 ensurestart = True
751 751