Show More
@@ -470,7 +470,8 b' if pycompat.iswindows:' | |||
|
470 | 470 | # See https://phab.mercurial-scm.org/D1701 for discussion |
|
471 | 471 | _creationflags = DETACHED_PROCESS | subprocess.CREATE_NEW_PROCESS_GROUP |
|
472 | 472 | |
|
473 | def runbgcommand(script, env, shell=False, stdout=None, stderr=None): | |
|
473 | def runbgcommand( | |
|
474 | script, env, shell=False, stdout=None, stderr=None, ensurestart=True): | |
|
474 | 475 | '''Spawn a command without waiting for it to finish.''' |
|
475 | 476 | # we can't use close_fds *and* redirect stdin. I'm not sure that we |
|
476 | 477 | # need to because the detached process has no console connection. |
@@ -480,12 +481,15 b' if pycompat.iswindows:' | |||
|
480 | 481 | creationflags=_creationflags, stdout=stdout, |
|
481 | 482 | stderr=stderr) |
|
482 | 483 | else: |
|
483 | def runbgcommand(cmd, env, shell=False, stdout=None, stderr=None): | |
|
484 | def runbgcommand( | |
|
485 | cmd, env, shell=False, stdout=None, stderr=None, ensurestart=True): | |
|
484 | 486 | '''Spawn a command without waiting for it to finish.''' |
|
485 | 487 | # double-fork to completely detach from the parent process |
|
486 | 488 | # based on http://code.activestate.com/recipes/278731 |
|
487 | 489 | pid = os.fork() |
|
488 | 490 | if pid: |
|
491 | if not ensurestart: | |
|
492 | return | |
|
489 | 493 | # Parent process |
|
490 | 494 | (_pid, status) = os.waitpid(pid, 0) |
|
491 | 495 | if os.WIFEXITED(status): |
General Comments 0
You need to be logged in to leave comments.
Login now