Mercurial > public > mercurial-scm > hg-stable
diff mercurial/cmdutil.py @ 10344:9501cde4c034
util: make spawndetached() handle subprocess early terminations
The file-based synchronization introduced by e22695b4472f hangs when the child
process fails before terminating the handshake, which the previous pipe-based
version handled correctly. To fix this, the parent polling loop was fixed to
detect premature terminations of the child process.
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Sat, 06 Feb 2010 16:50:00 +0100 |
parents | 08a0f04b56bd |
children | 6252852b4332 |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Sat Feb 06 17:31:54 2010 +0100 +++ b/mercurial/cmdutil.py Sat Feb 06 16:50:00 2010 +0100 @@ -584,9 +584,11 @@ elif runargs[i].startswith('--cwd'): del runargs[i:i + 2] break - pid = util.spawndetached(runargs) - while os.path.exists(lockpath): - time.sleep(0.1) + def condfn(): + return not os.path.exists(lockpath) + pid = util.rundetached(runargs, condfn) + if pid < 0: + raise util.Abort(_('child process failed to start')) finally: try: os.unlink(lockpath)