diff options
Diffstat (limited to 'modules/language/python/module/subprocess.py')
-rw-r--r-- | modules/language/python/module/subprocess.py | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/modules/language/python/module/subprocess.py b/modules/language/python/module/subprocess.py index d4dd259..cfbc4e4 100644 --- a/modules/language/python/module/subprocess.py +++ b/modules/language/python/module/subprocess.py @@ -132,12 +132,12 @@ else: import threading except ImportError: import dummy_threading as threading - pk(1) + # When select or poll has indicated that the file is writable, # we can write up to _PIPE_BUF bytes without risk of blocking. # POSIX defines PIPE_BUF as >= 512. _PIPE_BUF = getattr(select, 'PIPE_BUF', 512) - pk(2) + # poll/select have the advantage of not requiring any extra file # descriptor, contrarily to epoll/kqueue (also, they require a single # syscall). @@ -654,9 +654,7 @@ class Popen(object): # are -1 when not using PIPEs. The child objects are -1 # when not redirecting. - (p2cread, p2cwrite, - c2pread, c2pwrite, - errread, errwrite) = self._get_handles(stdin, stdout, stderr) + p2cread, p2cwrite,c2pread, c2pwrite,errread, errwrite = self._get_handles(stdin, stdout, stderr) # We wrap OS handles *before* launching the child, otherwise a # quickly terminating child could make our fds unwrappable @@ -1393,15 +1391,14 @@ class Popen(object): def _try_wait(self, wait_flags): """All callers to this function MUST hold self._waitpid_lock.""" try: - (pid, sts) = os.waitpid(self.pid, wait_flags) + pid, sts = os.waitpid(self.pid, wait_flags) except ChildProcessError: # This happens if SIGCLD is set to be ignored or waiting # for child processes has otherwise been disabled for our # process. This child is dead, we can't get the status. pid = self.pid sts = 0 - return (pid, sts) - + return pid, sts def wait(self, timeout=None, endtime=None): """Wait for child process to terminate. Returns returncode @@ -1429,7 +1426,7 @@ class Popen(object): try: if self.returncode is not None: break # Another thread waited. - (pid, sts) = self._try_wait(os.WNOHANG) + pid, sts = self._try_wait(os.WNOHANG) assert pid == self.pid or pid == 0 if pid == self.pid: self._handle_exitstatus(sts) @@ -1446,7 +1443,7 @@ class Popen(object): with self._waitpid_lock: if self.returncode is not None: break # Another thread waited. - (pid, sts) = self._try_wait(0) + pid, sts = self._try_wait(0) # Check the pid and loop as waitpid has been known to # return 0 even without WNOHANG in odd situations. # http://bugs.python.org/issue14396. |