# HG changeset patch # User Bryan O'Sullivan # Date 1199476344 28800 # Node ID 7b7f03c7dfa536ce5e7851b1b0d8ecbdc35d6ee0 # Parent 7705d308eb5e38d7d91ec2b22e77f17909eff2de serve: Don't change directory in the child if invoked with -d and --cwd diff -r 7705d308eb5e -r 7b7f03c7dfa5 mercurial/cmdutil.py --- 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)