Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 904de5b

Browse files
committed
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.
1 parent e7e9bf2 commit 904de5b

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

Lib/distutils/spawn.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,14 @@ def _spawn_posix (cmd,
144144
# Loop until the child either exits or is terminated by a signal
145145
# (ie. keep waiting if it's merely stopped)
146146
while 1:
147-
(pid, status) = os.waitpid(pid, 0)
147+
try:
148+
(pid, status) = os.waitpid(pid, 0)
149+
except OSError, exc:
150+
import errno
151+
if exc.errno == errno.EINTR:
152+
continue
153+
raise DistutilsExecError, \
154+
"command '%s' failed: %s" % (cmd[0], exc[-1])
148155
if os.WIFSIGNALED(status):
149156
raise DistutilsExecError, \
150157
"command '%s' terminated by signal %d" % \

0 commit comments

Comments
 (0)