##// END OF EJS Templates
stop read end of pipe from staying open forever in child process.
Vadim Gelfer -
r1741:9777298f default
parent child Browse files
Show More
@@ -2022,10 +2022,10 b' def serve(ui, repo, **opts):'
2022 if opts[o]:
2022 if opts[o]:
2023 ui.setconfig("web", o, opts[o])
2023 ui.setconfig("web", o, opts[o])
2024
2024
2025 if opts['daemon'] and not opts['daemon_pipefd']:
2025 if opts['daemon'] and not opts['daemon_pipefds']:
2026 rfd, wfd = os.pipe()
2026 rfd, wfd = os.pipe()
2027 args = sys.argv[:]
2027 args = sys.argv[:]
2028 args.append('--daemon-pipefd=' + str(wfd))
2028 args.append('--daemon-pipefds=%d,%d' % (rfd, wfd))
2029 pid = os.spawnvp(os.P_NOWAIT | getattr(os, 'P_DETACH', 0),
2029 pid = os.spawnvp(os.P_NOWAIT | getattr(os, 'P_DETACH', 0),
2030 args[0], args)
2030 args[0], args)
2031 os.close(wfd)
2031 os.close(wfd)
@@ -2056,8 +2056,9 b' def serve(ui, repo, **opts):'
2056 fp.write(str(os.getpid()))
2056 fp.write(str(os.getpid()))
2057 fp.close()
2057 fp.close()
2058
2058
2059 if opts['daemon_pipefd']:
2059 if opts['daemon_pipefds']:
2060 wfd = int(opts['daemon_pipefd'])
2060 rfd, wfd = [int(x) for x in opts['daemon_pipefds'].split(',')]
2061 os.close(rfd)
2061 os.write(wfd, 'y')
2062 os.write(wfd, 'y')
2062 os.close(wfd)
2063 os.close(wfd)
2063 sys.stdout.flush()
2064 sys.stdout.flush()
@@ -2505,7 +2506,7 b' table = {'
2505 (serve,
2506 (serve,
2506 [('A', 'accesslog', '', _('name of access log file to write to')),
2507 [('A', 'accesslog', '', _('name of access log file to write to')),
2507 ('d', 'daemon', None, _('run server in background')),
2508 ('d', 'daemon', None, _('run server in background')),
2508 ('', 'daemon-pipefd', '', ''),
2509 ('', 'daemon-pipefds', '', ''),
2509 ('E', 'errorlog', '', _('name of error log file to write to')),
2510 ('E', 'errorlog', '', _('name of error log file to write to')),
2510 ('p', 'port', 0, _('port to use (default: 8000)')),
2511 ('p', 'port', 0, _('port to use (default: 8000)')),
2511 ('a', 'address', '', _('address to use')),
2512 ('a', 'address', '', _('address to use')),
General Comments 0
You need to be logged in to leave comments. Login now