mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Make _spawn_posix be ready for EINTR. waitpid(2) can be interrupted
by SIGCHLD or sth because no signal is masked before. This fixes an optimized installation problem on FreeBSD libpthread.
This commit is contained in:
parent
e7e9bf2727
commit
904de5b734
1 changed files with 8 additions and 1 deletions
|
@ -144,7 +144,14 @@ def _spawn_posix (cmd,
|
|||
# Loop until the child either exits or is terminated by a signal
|
||||
# (ie. keep waiting if it's merely stopped)
|
||||
while 1:
|
||||
(pid, status) = os.waitpid(pid, 0)
|
||||
try:
|
||||
(pid, status) = os.waitpid(pid, 0)
|
||||
except OSError, exc:
|
||||
import errno
|
||||
if exc.errno == errno.EINTR:
|
||||
continue
|
||||
raise DistutilsExecError, \
|
||||
"command '%s' failed: %s" % (cmd[0], exc[-1])
|
||||
if os.WIFSIGNALED(status):
|
||||
raise DistutilsExecError, \
|
||||
"command '%s' terminated by signal %d" % \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue