diff -r c3e450bfdf34 -r 7a4772e92f23 mercurial/utils/procutil.py --- a/mercurial/utils/procutil.py Thu Mar 06 10:15:00 2025 +0100 +++ b/mercurial/utils/procutil.py Thu Mar 06 12:23:27 2025 +0100 @@ -743,7 +743,7 @@ script = b' '.join(shellquote(x) for x in cmd) if record_wait is None: # double-fork to completely detach from the parent process - script = b'( %s ) &' % script + script = b'( ( %s ) <&3 3<&- &) 3<&0' % script start_new_session = True else: start_new_session = False