Commit Graph

159 Commits

Author SHA1 Message Date
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
Gregory P. Smith f560485388 Get rid of the close_fds DeprecationWarning. Changes the default on a per
platform basis.  It remains False on Windows and changes to True on all
other platforms (POSIX).  Based on python-dev discussion and
http://bugs.python.org/issue7213.
2010-12-13 06:45:02 +00:00
Gregory P. Smith 8c647cd737 clarify the docs and new warning message. 2010-12-04 18:11:44 +00:00
Gregory P. Smith d4cc7bf993 issue6559: Adds a pass_fds parameter to subprocess.Popen that allows the caller
to list exactly which file descriptors should be kept open.
2010-12-04 11:22:11 +00:00
Gregory P. Smith d23047b62c issue7213 + issue2320: Cause a DeprecationWarning if the close_fds argument is
not passed to subprocess.Popen as the default value will be changing in a
future Python to the safer and more often desired value of True.

DeprecationWarnings that show up in a lot of existing code are controversial
and have caused pain in the past.  I'd like to leave this on for 3.2 beta1 and
see how things go.  We can remove the warning if it is deemed too noisy during
any betas.  (case study: the md5 and sha module DeprecationWarnings are loathed
around the world as those modules were never going to be removed in 2.x and
2to3 has a fixer for code that uses them)
2010-12-04 09:10:44 +00:00
Brian Curtin 79cdb661f5 Fix #10554. Added context manager support to Popen objects.
Added a few common Popen uses to the tests like we've done for a few other
instances of adding context managers. Eventually the entire test suite
could be converted to use the context manager format.
2010-12-03 02:46:02 +00:00
Benjamin Peterson b8bc439b20 don't shadow globals 2010-11-20 18:24:54 +00:00
Benjamin Peterson 5f78040057 add filename to ENOENT message #4925 2010-11-20 18:07:52 +00:00