##// END OF EJS Templates
serve: Don't change directory in the child if invoked with -d and --cwd
Bryan O'Sullivan -
r5797:7b7f03c7 default
parent child Browse files
Show More
@@ -495,6 +495,15 b' def service(opts, parentfn=None, initfn='
495 rfd, wfd = os.pipe()
495 rfd, wfd = os.pipe()
496 args = sys.argv[:]
496 args = sys.argv[:]
497 args.append('--daemon-pipefds=%d,%d' % (rfd, wfd))
497 args.append('--daemon-pipefds=%d,%d' % (rfd, wfd))
498 # Don't pass --cwd to the child process, because we've already
499 # changed directory.
500 for i in xrange(1,len(args)):
501 if args[i].startswith('--cwd='):
502 del args[i]
503 break
504 elif args[i].startswith('--cwd'):
505 del args[i:i+2]
506 break
498 pid = os.spawnvp(os.P_NOWAIT | getattr(os, 'P_DETACH', 0),
507 pid = os.spawnvp(os.P_NOWAIT | getattr(os, 'P_DETACH', 0),
499 args[0], args)
508 args[0], args)
500 os.close(wfd)
509 os.close(wfd)
General Comments 0
You need to be logged in to leave comments. Login now