--- trunk-original-subprocess.py Wed Aug 12 18:03:33 2009 +++ trunk-chadchanged-subprocess.py Wed Aug 12 18:13:14 2009 @@ -456,7 +456,14 @@ retcode = call(["ls", "-l"]) """ - return Popen(*popenargs, **kwargs).wait() + process = Popen(*popenargs, **kwargs) + while True: + try: # We must not abort and lose the process handle for just EINTR. + return process.wait() + except OSError, e: + if e.errno == errno.EINTR: + continue + raise def check_call(*popenargs, **kwargs): @@ -1142,8 +1149,15 @@ if errwrite is not None and errread is not None: os.close(errwrite) - # Wait for exec to fail or succeed; possibly raising exception - data = os.read(errpipe_read, 1048576) # Exception limited to 1M + # Wait for exec to fail or succeed; possibly raising exception, ignoring EINTR + while True: + try: + data = os.read(errpipe_read, 1048576) # Exception limited to 1M + break + except OSError, e: + if e.errno == errno.EINTR: + continue + raise finally: # be sure the FD is closed no matter what os.close(errpipe_read)