Commit Graph

166 Commits

Author SHA1 Message Date
Antoine Pitrou 24d659daaf Use InterruptedError instead of checking for EINTR 2011-10-23 23:49:42 +02:00
Victor Stinner c15c88c13d Issue #12494: Close pipes and kill process on error in subprocess functions
On error, call(), check_call(), check_output() and getstatusoutput() functions
of the subprocess module now kill the process, read its status (to avoid
zombis) and close pipes.
2011-09-01 23:45:04 +02:00
Charles-François Natali 558639f0c9 Issue #12650: Fix a race condition where a subprocess.Popen could leak
resources (FD/zombie) when killed at the wrong time.
2011-08-18 19:11:29 +02:00
Charles-François Natali 134a8baed9 Issue #12650: Fix a race condition where a subprocess.Popen could leak
resources (FD/zombie) when killed at the wrong time.
2011-08-18 18:49:39 +02:00
Ross Lagerwall d98646e430 Issue #12607: In subprocess, fix issue where if stdin, stdout or stderr is
given as a low fd, it gets overwritten.
2011-07-27 07:16:31 +02:00
Antoine Pitrou e02891b459 Issue #12591: Improve support of "universal newlines" in the subprocess
module: the piped streams can now be properly read from or written to.
2011-07-23 22:04:41 +02:00
Antoine Pitrou ab85ff3d1a Issue #12591: Improve support of "universal newlines" in the subprocess
module: the piped streams can now be properly read from or written to.

(this was broken due to the 2.x to 3.x transition; communicate() support
is still sketchy)
2011-07-23 22:03:45 +02:00
Victor Stinner 5b1261d750 (merge 3.2) Issue #12493: subprocess: communicate() handles EINTR
subprocess.Popen.communicate() now also handles EINTR errors if the process has
only one pipe.
2011-07-05 14:04:39 +02:00
Victor Stinner 2cfb6f3aa0 Issue #12493: subprocess: communicate() handles EINTR
subprocess.Popen.communicate() now also handles EINTR errors if the process has
only one pipe.
2011-07-05 14:00:56 +02:00
Victor Stinner 372b838db5 (merge 3.2) Close #12383: Fix subprocess module with env={}: don't copy the
environment variables, start with an empty environment.
2011-06-21 17:24:21 +02:00
Victor Stinner f1512a2967 Close #12383: Fix subprocess module with env={}: don't copy the environment
variables, start with an empty environment.
2011-06-21 17:18:38 +02:00
Victor Stinner 1b5b9d7434 (Merge 3.2) Close #12085: Fix an attribute error in subprocess.Popen destructor
if the constructor has failed, e.g. because of an undeclared keyword argument.
Patch written by Oleg Oshmyan.
2011-06-01 00:58:57 +02:00
Victor Stinner 87b9bc3893 Close #12085: Fix an attribute error in subprocess.Popen destructor if the
constructor has failed, e.g. because of an undeclared keyword argument. Patch
written by Oleg Oshmyan.
2011-06-01 00:57:47 +02:00
Gregory P. Smith 59fd1bfcc1 The _posixsubprocess module is now required on POSIX.
Remove the pure Python POSIX subprocess implementation.

If non-CPython VMs (are there any for 3.x yet?) were somehow depending
on this, they already have the exact same set of problems with Python
code being executed after os.fork() that _posixsubprocess was written
to deal with.  They should implement an equivalent outside of Python.
2011-05-28 09:32:39 -07:00
Gregory P. Smith a454ef6985 Update documentation to mention bytes instead byte string and correct one
mentioned string to the accurate description of what type is required.
2011-05-22 22:29:49 -07:00
Gregory P. Smith 0ef3e399b8 normalize whitespace. 2011-05-11 22:20:11 -07:00
Gregory P. Smith c9557af441 merge - 7a3f3ad83676 Fixes Issue #12044. 2011-05-11 22:18:23 -07:00
Gregory P. Smith 6b65745430 - Issue #12044: Fixed subprocess.Popen when used as a context manager to
wait for the process to end when exiting the context to avoid unintentionally
  leaving zombie processes around.
2011-05-11 21:42:08 -07:00
Brian Curtin 5d9deaa9d8 whitespace fix 2011-04-29 16:24:07 -05:00
Brian Curtin b8f8b4e54b merge 2011-04-29 16:14:55 -05:00
Brian Curtin 08fd8d93f7 merge 2011-04-29 16:11:30 -05:00
Brian Curtin 8b8e7f467f Further fix #7838. CREATE_NEW_CONSOLE was exposed, but none of the
constants to be used for STARTUPINFO were exposed due to the change.
2011-04-29 15:48:13 -05:00
Ross Lagerwall 0b9ea93a64 Merge with 3.2 2011-04-05 16:07:49 +02:00
Ross Lagerwall 02ba73c0ef Merge with 3.1 2011-04-05 15:48:47 +02:00
Ross Lagerwall 4f61b02520 Issue #10963: Ensure that subprocess.communicate() never raises EPIPE. 2011-04-05 15:34:00 +02:00
Victor Stinner 7a8d08110c Issue #11757: subprocess ensures that select() and poll() timeout >= 0 2011-04-05 13:13:08 +02:00
Ross Lagerwall f382ab25ca Issue #11692: Remove unnecessary demo functions in subprocess module. 2011-03-27 17:34:22 +02:00
Reid Kleckner 91156ff3f1 Fix timeout error message on windows to not be in milliseconds. 2011-03-21 10:06:10 -07:00
Reid Kleckner 9a67e6c743 Fix the Windows timeout code. 2011-03-20 08:28:07 -07:00
Antoine Pitrou 7b98d02302 Issue #11459: A `bufsize` value of 0 in subprocess.Popen() really creates
unbuffered pipes, such that select() works properly on them.
2011-03-19 17:04:13 +01:00
Antoine Pitrou 877766dee8 Issue #11459: A `bufsize` value of 0 in subprocess.Popen() really creates
unbuffered pipes, such that select() works properly on them.
2011-03-19 17:00:37 +01:00
Ezio Melotti 3b3499ba69 #11565: Merge with 3.1. 2011-03-16 11:35:38 +02:00
Ezio Melotti 13925008dc #11565: Fix several typos. Patch by Piotr Kasprzyk. 2011-03-16 11:05:33 +02:00
Antoine Pitrou 1679f4daa1 Issue #11459: A `bufsize` value of 0 in subprocess.Popen() really creates
unbuffered pipes, such that select() works properly on them.
2011-03-19 17:06:22 +01:00
Reid Kleckner 2b228f0d9b Include the timeout value in TimeoutExpired.
This was the original intention, but it wasn't threaded all the way through due
to 'endtime'.  Also added a trivial assertion to get coverage of __str__.
2011-03-16 16:57:54 -04:00
Ross Lagerwall ba102ec10d Issue #5870: Add subprocess.DEVNULL constant. 2011-03-16 18:40:25 +02:00
Ezio Melotti b88ed1549e #11565: Merge with 3.2. 2011-03-16 11:38:59 +02:00
Gregory P. Smith b4039aaf35 whitespace fix 2011-03-14 14:16:20 -04:00
Gregory P. Smith 54d412edcc Add a SubprocessError base class for exceptions in the subprocess module. 2011-03-14 14:08:43 -04:00
Reid Kleckner 31aa7dd141 Add a 'timeout' argument to subprocess.Popen.
If the timeout expires before the subprocess exits, the wait method and the
communicate method will raise a subprocess.TimeoutExpired exception.  When used
with communicate, it is possible to catch the exception, kill the process, and
retry the communicate and receive any output written to stdout or stderr.
2011-03-14 12:02:10 -04:00
Victor Stinner 7b3b20ad29 Issue #8513: On UNIX, subprocess supports bytes command string. 2011-03-03 12:54:05 +00:00
Antoine Pitrou c99823211b In subprocess, wrap pipe fds before launching the child. Hopefully this
will fix intermittent failures on some buildbots (issue #8458).
2011-01-04 19:07:07 +00:00
Antoine Pitrou 47f14bade8 Un-complicate some code 2011-01-03 23:42:01 +00:00
Antoine Pitrou f50a6b6b6d Merged revisions 87695 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r87695 | antoine.pitrou | 2011-01-03 19:23:55 +0100 (lun., 03 janv. 2011) | 5 lines

  Issue #10806, issue #9905: Fix subprocess pipes when some of the standard
  file descriptors (0, 1, 2) are closed in the parent process.  Initial
  patch by Ross Lagerwall.
........
2011-01-03 18:36:36 +00:00
Antoine Pitrou c9c83ba896 Issue #10806, issue #9905: Fix subprocess pipes when some of the standard
file descriptors (0, 1, 2) are closed in the parent process.  Initial
patch by Ross Lagerwall.
2011-01-03 18:23:55 +00:00
Victor Stinner 667d4b577f Issue #10763: subprocess.communicate() closes stdout and stderr if both are
pipes (bug specific to Windows).

Improve also the unit test: write a portable unit test.
2010-12-25 22:40:32 +00:00
Gregory P. Smith b740e76af0 Merged revisions 87233 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r87233 | gregory.p.smith | 2010-12-14 06:38:00 -0800 (Tue, 14 Dec 2010) | 4 lines

  Issue #1731717: Fixed the problem where subprocess.wait() could cause an
  OSError exception when The OS had been told to ignore SIGCLD in our process
  or otherwise not wait for exiting child processes.
........
2010-12-14 15:16:24 +00:00
Gregory P. Smith e85db2bbb8 Issue #1731717: Fixed the problem where subprocess.wait() could cause an
OSError exception when The OS had been told to ignore SIGCLD in our process
or otherwise not wait for exiting child processes.
2010-12-14 14:38:00 +00:00
Gregory P. Smith 8edd99d085 Issue #6559: fix the subprocess.Popen pass_fds implementation. Add a unittest.
Issue #7213: Change the close_fds default on Windows to better match the new
default on POSIX.  True when possible (False if stdin/stdout/stderr are
supplied).

Update the documentation to reflect all of the above.
2010-12-14 13:43:30 +00:00
Gregory P. Smith 51ee270876 issue7213: Open the pipes used by subprocesses with the FD_CLOEXEC flag from
the C code, using pipe2() when available.  Adds unittests for close_fds and
cloexec behaviors.
2010-12-13 07:59:39 +00:00