Mercurial > hg-stable
changeset 5797:7b7f03c7dfa5
serve: Don't change directory in the child if invoked with -d and --cwd
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Fri, 04 Jan 2008 11:52:24 -0800 |
parents | 7705d308eb5e |
children | 86f5d8f608b7 |
files | mercurial/cmdutil.py |
diffstat | 1 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Fri Jan 04 14:25:04 2008 +0100 +++ b/mercurial/cmdutil.py Fri Jan 04 11:52:24 2008 -0800 @@ -495,6 +495,15 @@ rfd, wfd = os.pipe() args = sys.argv[:] args.append('--daemon-pipefds=%d,%d' % (rfd, wfd)) + # Don't pass --cwd to the child process, because we've already + # changed directory. + for i in xrange(1,len(args)): + if args[i].startswith('--cwd='): + del args[i] + break + elif args[i].startswith('--cwd'): + del args[i:i+2] + break pid = os.spawnvp(os.P_NOWAIT | getattr(os, 'P_DETACH', 0), args[0], args) os.close(wfd)