]> granicus.if.org Git - python/commitdiff
Make _spawn_posix be ready for EINTR. waitpid(2) can be interrupted
authorHye-Shik Chang <hyeshik@gmail.com>
Tue, 24 Feb 2004 23:54:17 +0000 (23:54 +0000)
committerHye-Shik Chang <hyeshik@gmail.com>
Tue, 24 Feb 2004 23:54:17 +0000 (23:54 +0000)
by SIGCHLD or sth because no signal is masked before. This fixes
an optimized installation problem on FreeBSD libpthread.

Lib/distutils/spawn.py

index 4857ce5e633dcb5055b83090c230e1fa6c8b51ba..67391e8826b11fec10f401c4c7bc83fd3f5b7c56 100644 (file)
@@ -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" % \