# HG changeset patch # User Vadim Gelfer # Date 1140222727 28800 # Node ID 9777298fed84c90ef78726915e79482e8149866c # Parent f95654385065a35c8f67db46f4e91b78938786af stop read end of pipe from staying open forever in child process. diff -r f95654385065 -r 9777298fed84 mercurial/commands.py --- a/mercurial/commands.py Fri Feb 17 16:29:30 2006 -0800 +++ b/mercurial/commands.py Fri Feb 17 16:32:07 2006 -0800 @@ -2022,10 +2022,10 @@ if opts[o]: ui.setconfig("web", o, opts[o]) - if opts['daemon'] and not opts['daemon_pipefd']: + if opts['daemon'] and not opts['daemon_pipefds']: rfd, wfd = os.pipe() args = sys.argv[:] - args.append('--daemon-pipefd=' + str(wfd)) + args.append('--daemon-pipefds=%d,%d' % (rfd, wfd)) pid = os.spawnvp(os.P_NOWAIT | getattr(os, 'P_DETACH', 0), args[0], args) os.close(wfd) @@ -2056,8 +2056,9 @@ fp.write(str(os.getpid())) fp.close() - if opts['daemon_pipefd']: - wfd = int(opts['daemon_pipefd']) + if opts['daemon_pipefds']: + rfd, wfd = [int(x) for x in opts['daemon_pipefds'].split(',')] + os.close(rfd) os.write(wfd, 'y') os.close(wfd) sys.stdout.flush() @@ -2505,7 +2506,7 @@ (serve, [('A', 'accesslog', '', _('name of access log file to write to')), ('d', 'daemon', None, _('run server in background')), - ('', 'daemon-pipefd', '', ''), + ('', 'daemon-pipefds', '', ''), ('E', 'errorlog', '', _('name of error log file to write to')), ('p', 'port', 0, _('port to use (default: 8000)')), ('a', 'address', '', _('address to use')),