##// END OF EJS Templates
Find right hg command for detached process...
Patrick Mezard -
r10239:8e4be44a default
parent child Browse files
Show More
@@ -461,9 +461,9 b' def start(ui, dirstate, root, opts):'
461 self.master.shutdown()
461 self.master.shutdown()
462
462
463 if 'inserve' not in sys.argv:
463 if 'inserve' not in sys.argv:
464 runargs = [sys.argv[0], 'inserve', '-R', root]
464 runargs = util.hgcmd() + ['inserve', '-R', root]
465 else:
465 else:
466 runargs = sys.argv[:]
466 runargs = util.hgcmd() + sys.argv[1:]
467
467
468 pidfile = ui.config('inotify', 'pidfile')
468 pidfile = ui.config('inotify', 'pidfile')
469 if opts['daemon'] and pidfile is not None and 'pid-file' not in runargs:
469 if opts['daemon'] and pidfile is not None and 'pid-file' not in runargs:
@@ -572,7 +572,7 b' def service(opts, parentfn=None, initfn='
572 os.close(lockfd)
572 os.close(lockfd)
573 try:
573 try:
574 if not runargs:
574 if not runargs:
575 runargs = sys.argv[:]
575 runargs = util.hgcmd() + sys.argv[1:]
576 runargs.append('--daemon-pipefds=%s' % lockpath)
576 runargs.append('--daemon-pipefds=%s' % lockpath)
577 # Don't pass --cwd to the child process, because we've already
577 # Don't pass --cwd to the child process, because we've already
578 # changed directory.
578 # changed directory.
@@ -262,3 +262,5 b' def spawndetached(args):'
262 return os.spawnvp(os.P_NOWAIT | getattr(os, 'P_DETACH', 0),
262 return os.spawnvp(os.P_NOWAIT | getattr(os, 'P_DETACH', 0),
263 args[0], args)
263 args[0], args)
264
264
265 def gethgcmd():
266 return sys.argv[:1]
@@ -1274,3 +1274,14 b' def iterlines(iterator):'
1274
1274
1275 def expandpath(path):
1275 def expandpath(path):
1276 return os.path.expanduser(os.path.expandvars(path))
1276 return os.path.expanduser(os.path.expandvars(path))
1277
1278 def hgcmd():
1279 """Return the command used to execute current hg
1280
1281 This is different from hgexecutable() because on Windows we want
1282 to avoid things opening new shell windows like batch files, so we
1283 get either the python call or current executable.
1284 """
1285 if main_is_frozen():
1286 return [sys.executable]
1287 return gethgcmd()
@@ -352,6 +352,9 b' def spawndetached(args):'
352 STARTUPINFO())
352 STARTUPINFO())
353 return pid
353 return pid
354
354
355 def gethgcmd():
356 return [sys.executable] + sys.argv[:1]
357
355 try:
358 try:
356 # override functions with win32 versions if possible
359 # override functions with win32 versions if possible
357 from win32 import *
360 from win32 import *
General Comments 0
You need to be logged in to leave comments. Login now