Commit Graph

443 Commits

Author SHA1 Message Date
Gregory P. Smith 1c27e3c7fb Fixes Issue #15798 - subprocess.Popen() no longer fails if file
descriptor 0, 1 or 2 is closed.
2013-11-30 19:04:00 -08:00
Gregory P. Smith 1eda9e7c30 Fixes Issue #15798 - subprocess.Popen() no longer fails if file
descriptor 0, 1 or 2 is closed.
2013-11-30 19:02:57 -08:00
Victor Stinner 5323fb0990 Issue #19637: fix test_undecodable_env() of test_subprocess on AIX
On AIX, the C locale encoding uses the ISO-8859-1 encoding, not ASCII.
2013-11-19 23:46:06 +01:00
Charles-François Natali 3a4586a9f9 Issue #18923: Update subprocess to use the new selectors module. 2013-11-08 19:56:59 +01:00
Tim Golden ab7211f278 Issue #10197 Rework subprocess.get[status]output to use subprocess functionality and thus to work on Windows. Patch by Nick Coghlan. 2013-11-03 12:55:51 +00:00
Tim Golden e004175c56 Issue #10197 Rework subprocess.get[status]output to use subprocess functionality and thus to work on Windows. Patch by Nick Coghlan. 2013-11-03 12:53:17 +00:00
Antoine Pitrou fd4722cacf Issue #9548: Add a minimal "_bootlocale" module that is imported by the _io module instead of the full locale module. 2013-10-12 00:13:50 +02:00
Antoine Pitrou 77e904e6a6 Issue #18948: improve SuppressCoreFiles to include Windows crash popup suppression, and use it in more tests.
Patch by Valerie Lambert and Zachary Ware.
2013-10-08 23:04:32 +02:00
Antoine Pitrou b0478b3f5f Issue #18623: Factor out the _SuppressCoreFiles context manager into test.support.
Patch by Valerie Lambert.
2013-09-06 20:50:00 +02:00
Victor Stinner f6fa22efe0 Issue #18571: Merge duplicate test code
Merge test/subprocessdata/inherited.py into test/subprocessdata/fd_status.py
2013-09-01 10:22:41 +02:00
Antoine Pitrou 267964c837 Forward port new tests from Issue #18851. 2013-08-31 00:12:37 +02:00
Antoine Pitrou a8392717f1 Forward port new tests from Issue #18851. 2013-08-30 23:38:13 +02:00
Gregory P. Smith 6cc50391a6 Fixes Issue #15507: test_subprocess's test_send_signal could fail if the test
runner were run in an environment where the process inherited an ignore
setting for SIGINT.  Restore the SIGINT handler to the desired
KeyboardInterrupt raising one during that test.
2013-08-29 13:39:44 -07:00
Gregory P. Smith dee0434e2f Fixes issue #15507: test_subprocess's test_send_signal could fail if the test
runner were run in an environment where the process inherited an ignore
setting for SIGINT.  Restore the SIGINT handler to the desired
KeyboardInterrupt raising one during that test.
2013-08-29 13:35:27 -07:00
Victor Stinner daf455554b Issue #18571: Implementation of the PEP 446: file descriptors and file handles
are now created non-inheritable; add functions os.get/set_inheritable(),
os.get/set_handle_inheritable() and socket.socket.get/set_inheritable().
2013-08-28 00:53:59 +02:00
Charles-François Natali a439b32cf0 Merge. 2013-08-25 18:28:44 +02:00
Charles-François Natali 249cdc39fc Issue #18763: subprocess: The file descriptors are now closed after calling the
preexec_fn callback, which may open file descriptors.
2013-08-25 18:24:45 +02:00
Ned Deily 582583bc41 Issue #17046: merge from 3.3 2013-08-02 18:05:31 -07:00
Ned Deily e92dfbfec8 Issue #17046: Fix test_subprocess test_executable_without_cwd broken test case. 2013-08-02 18:02:21 -07:00
Antoine Pitrou 284e5ce67e Fix the RLIMIT_CORE resource lowering logic in test_subprocess.
We must only lower the soft limit, since lowering the hard limit makes it impossible to raise it back at the end.
(this could prevent core dumps from being generated when the test suite crashes)
2013-08-02 00:08:51 +02:00
Richard Oudkerk a35a128acc Merge. 2013-06-10 16:31:39 +01:00
Richard Oudkerk 0e547b66dc Issue #18174: Fix fd leaks in tests. 2013-06-10 16:29:19 +01:00
Antoine Pitrou dc49b2b88c Try to make test more reliable (saw some sporadic failures on buildbots) 2013-05-19 15:55:40 +02:00
Antoine Pitrou 5b6616dee3 Try to make test more reliable (saw some sporadic failures on buildbots) 2013-05-19 15:55:59 +02:00
Serhiy Storchaka fcd9f22238 Issue #16624: `subprocess.check_output` now accepts an `input` argument,
allowing the subprocess's stdin to be provided as a (byte) string.
Patch by Zack Weinberg.
2013-04-22 20:20:54 +03:00
Gregory P. Smith 4a8ea9e2a6 Fixes issue #17488: Change the subprocess.Popen bufsize parameter default value
from unbuffered (0) to buffering (-1) to match the behavior existing code
expects and match the behavior of the subprocess module in Python 2 to avoid
introducing hard to track down bugs.
2013-03-23 12:00:00 -07:00
Gregory P. Smith a1b9ed32ee Fixes issue #17488: Change the subprocess.Popen bufsize parameter default value
from unbuffered (0) to buffering (-1) to match the behavior existing code
expects and match the behavior of the subprocess module in Python 2 to avoid
introducing hard to track down bugs.
2013-03-23 11:54:22 -07:00
Gregory P. Smith a1ed539268 Fixes issue #17488: Change the subprocess.Popen bufsize parameter default value
from unbuffered (0) to buffering (-1) to match the behavior existing code
expects and match the behavior of the subprocess module in Python 2 to avoid
introducing hard to track down bugs.
2013-03-23 11:44:25 -07:00
Ezio Melotti c0417357d1 #11963: merge with 3.3. 2013-03-11 06:03:05 +02:00
Ezio Melotti 3300878d8c #11963: merge with 3.2. 2013-03-11 05:59:55 +02:00
Ezio Melotti 42a541bd49 #11963: remove human verification from test_parser and test_subprocess. 2013-03-11 05:53:34 +02:00
Serhiy Storchaka b3f194d109 Issue #16903: Popen.communicate() on Unix now accepts strings when
universal_newlines is true as on Windows.
2013-02-04 16:47:39 +02:00
Charles-François Natali 6c566b3ce9 Issue #16762: Fix some test_subprocess failures on NetBSD and OpenBSD: kill()
returns ESRCH for a zombie process, which is not POSIX-compliant.
2013-01-12 16:55:31 +01:00
Charles-François Natali dbc744ac74 Issue #16762: Fix some test_subprocess failures on NetBSD and OpenBSD: kill()
returns ESRCH for a zombie process, which is not POSIX-compliant.
2013-01-12 16:54:45 +01:00
Charles-François Natali 53221e371d Issue #16762: Fix some test_subprocess failures on NetBSD and OpenBSD: kill()
returns ESRCH for a zombie process, which is not POSIX-compliant.
2013-01-12 16:52:20 +01:00
Andrew Svetlov 0c8ee7fc8b fix test for subprocess (#16644) 2012-12-26 23:36:17 +02:00
Andrew Svetlov b172697cd8 fix test for subprocess (#16644) 2012-12-26 23:34:54 +02:00
Andrew Svetlov 57a1233110 fix test for subprocess (#16644) 2012-12-26 23:31:45 +02:00
Andrew Svetlov 3438fa496d Get rig of EnvironmentError (#16705) 2012-12-17 23:35:18 +02:00
Gregory P. Smith 65ee6ece2d Refactor test_preexec_errpipe to not create an uncollectable reference cycle. 2012-11-11 10:12:40 -08:00
Gregory P. Smith 859035d2ef Refactor test_preexec_errpipe to not create an uncollectable reference cycle. 2012-11-11 10:00:49 -08:00
Gregory P. Smith e27faac45f Refactor test_preexec_errpipe to not create an uncollectable reference cycle. 2012-11-11 09:59:27 -08:00
Gregory P. Smith c2c4cb624b Fixes issue #16140: The subprocess module no longer double closes its
child subprocess.PIPE parent file descriptors on child error prior to
exec().

This would lead to race conditions in multithreaded programs where
another thread opened a file reusing the fd which was then closed out
from beneath it by the errant second close.
2012-11-11 01:41:49 -08:00
Gregory P. Smith c8ac03d936 Fixes issue #16140: The subprocess module no longer double closes its
child subprocess.PIPE parent file descriptors on child error prior to
exec().

This would lead to race conditions in multithreaded programs where
another thread opened a file reusing the fd which was then closed out
from beneath it by the errant second close.
2012-11-11 01:38:18 -08:00
Gregory P. Smith 12489d98e6 Fixes issue #16140: The subprocess module no longer double closes its
child subprocess.PIPE parent file descriptors on child error prior to
exec().

This would lead to race conditions in multithreaded programs where
another thread opened a file reusing the fd which was then closed out
from beneath it by the errant second close.
2012-11-11 01:37:02 -08:00
Gregory P. Smith 8d07c264e4 Raise our own SubprocessError rather than a RuntimeError in when dealing with
odd rare errors coming from the subprocess module.
2012-11-10 23:53:47 -08:00
Gregory P. Smith 561cbc4e7b Fixes issue #16327: The subprocess module no longer leaks file descriptors
used for stdin/stdout/stderr pipes to the child when fork() fails.
2012-11-10 22:33:23 -08:00
Gregory P. Smith 3d8e776cd9 Fixes issue #16327: The subprocess module no longer leaks file descriptors
used for stdin/stdout/stderr pipes to the child when fork() fails.
2012-11-10 22:32:22 -08:00
Gregory P. Smith a10ddb8a55 Fixes Issue #16114: The subprocess module no longer provides a
misleading error message stating that args[0] did not exist when
either the cwd or executable keyword arguments specified a path that
did not exist.
2012-10-10 03:44:47 -07:00
Gregory P. Smith 5591b02a4c Fixes Issue #16114: The subprocess module no longer provides a
misleading error message stating that args[0] did not exist when
either the cwd or executable keyword arguments specified a path that
did not exist.

It now keeps track of if the child got as far as preexec and reports it if
not back to the parent via a special "noexec" error message value in
the error pipe so that the cwd can be blamed for a failed chdir
instead of the exec of the executable being blamed instead.

The executable is also always reported accurately when exec fails.

Unittests enhanced to cover these cases.
2012-10-10 03:34:47 -07:00
Chris Jerdonek 86b0fb23e5 Issue #16170: Remove Linux skip from test_subprocess's test_executable test. 2012-10-09 13:17:49 -07:00
Chris Jerdonek 2d051b8eaf Issue #16115: Skip a newly added subprocess.Popen() test on Linux. 2012-10-08 17:53:46 -07:00
Chris Jerdonek 776cb199bc Issue #16115: Improve testing of the executable argument to subprocess.Popen(). 2012-10-08 15:56:43 -07:00
Andrew Svetlov a2028733ef revert accidental inclusion of subprocess tests 2012-10-06 18:45:47 +03:00
Andrew Svetlov b2209ccfa0 revert accidental inclusion of subprocess tests 2012-10-06 18:45:24 +03:00
Andrew Svetlov 5061a34283 Issue #16025: Minor corrections to the zipfile documentation.
Patch by Serhiy Storchaka.
2012-10-06 18:10:01 +03:00
Andrew Svetlov afbf90c993 Issue #16025: Minor corrections to the zipfile documentation.
Patch by Serhiy Storchaka.
2012-10-06 18:02:05 +03:00
Andrew Svetlov 1a53c0cbf5 Issue #16115: Add test for check that executable arg to Popen() takes precedence over args[0] arg\n \n Patch by Kushal Das 2012-10-05 22:52:15 +03:00
Chris Jerdonek 9a6ada8026 Issue #15533: Merge update from 3.2. 2012-09-30 09:46:04 -07:00
Chris Jerdonek c2cd626497 Issue #15533: Skip test_cwd_with_relative_*() tests on Windows pending resolution of issue. 2012-09-30 09:45:00 -07:00
Chris Jerdonek 28714c8c26 Issue #15533: Merge fix from 3.2. 2012-09-30 02:15:37 -07:00
Chris Jerdonek ec3ea94251 Issue #15533: Clarify docs and add tests for subprocess.Popen()'s cwd argument. 2012-09-30 00:10:28 -07:00
Andrew Svetlov a19de803e4 Issue #15595: Fix subprocess.Popen(universal_newlines=True)
for certain locales (utf-16 and utf-32 family).

Patch by Chris Jerdonek.
2012-08-19 22:20:03 +03:00
Andrew Svetlov 828607170d Issue #15595: Fix subprocess.Popen(universal_newlines=True)
for certain locales (utf-16 and utf-32 family).

Patch by Chris Jerdonek.
2012-08-19 22:13:41 +03:00
Andrew Svetlov 47ec25d2f6 Brush subprocess tests a bit. 2012-08-19 16:25:37 +03:00
Andrew Svetlov 943c5b31b6 Fix subprocess test broken on Windows 2012-08-16 20:17:47 +03:00
Andrew Svetlov 5395d2f07d Add yet another test for subprocess.Popen.communicate 2012-08-15 22:46:43 +03:00
Andrew Svetlov aa0dbdc2dd Issue #15592. Fix regression: subprocess.communicate() breaks on no input with universal newlines true.
Patch by Chris Jerdonek.
2012-08-14 18:40:21 +03:00
Andrew Svetlov f3765071eb Add test to explicit check the absence regression in subprocess (issue #15592).
Patch by Chris Jerdonek.
2012-08-14 18:35:17 +03:00
Antoine Pitrou 6f1a40ffd3 Merge universal newlines-related fixes (issue #13119) 2012-08-05 00:25:31 +02:00
Antoine Pitrou ec2d26930c Fix universal newlines test to avoid the newline translation done by sys.stdout. 2012-08-05 00:23:40 +02:00
Vinay Sajip 7ded1f0f69 Implemented PEP 405 (Python virtual environments). 2012-05-26 03:45:29 +01:00
Antoine Pitrou b69ef16fe6 Issue #14252: Fix subprocess.Popen.terminate() to not raise an error under Windows when the child process has already exited. 2012-03-11 19:33:29 +01:00
Antoine Pitrou 1f9a835400 Issue #14252: Fix subprocess.Popen.terminate() to not raise an error under Windows when the child process has already exited. 2012-03-11 19:29:12 +01:00
Ross Lagerwall e7ad419058 Fix sporadic test_subprocess regression introduced by 834650d63130. 2012-02-22 06:02:07 +02:00
Georg Brandl 2fb477c0f0 Merge 3.2: Issue #13703 plus some related test suite fixes. 2012-02-21 00:33:36 +01:00
Georg Brandl a86b262d1e Fix bad inheritance in test_subprocess that led to a number of tests being executed twice. 2012-02-20 21:34:57 +01:00
Ross Lagerwall 003c7a3fca Fix a typo. 2012-02-12 09:02:01 +02:00
Ross Lagerwall ab66d2a6cb Attempt to speed up some subprocess tests (and hopefully keep them reliable). 2012-02-12 09:01:30 +02:00
Gregory P. Smith 0648458b84 Fix a unittest error seen on NetBSD 5. 2012-01-21 22:06:09 -08:00
Gregory P. Smith 886455cc4e Fix a unittest error seen on NetBSD 5. 2012-01-21 22:05:10 -08:00
Gregory P. Smith d635af5a61 Fixes issue #8052: The posix subprocess module's close_fds behavior was
suboptimal by closing all possible file descriptors rather than just
the open ones in the child process before exec().

It now closes only the open fds when it is possible to safely determine what
those are.
2012-01-21 14:39:29 -08:00
Gregory P. Smith 8facece99a Fixes issue #8052: The posix subprocess module's close_fds behavior was
suboptimal by closing all possible file descriptors rather than just
the open ones in the child process before exec().

It now closes only the open fds when it is possible to safely determine what
those are.
2012-01-21 14:01:08 -08:00
Benjamin Peterson ce2af33562 merge 3.2 2011-12-10 12:44:37 -05:00
Benjamin Peterson b870aa1255 we're always going to have gc 2011-12-10 12:44:25 -05:00
Benjamin Peterson d3a345a21f merge 3.2 2011-12-10 12:38:52 -05:00
Benjamin Peterson 964561bb7c you can't get resource.error if you can't import resource 2011-12-10 12:31:42 -05:00
Nadeem Vawda 74adbaa7bd Merge: Fix ResourceWarnings in test_subprocess. 2011-08-19 05:14:40 +02:00
Nadeem Vawda 0d7cda3e63 Fix ResourceWarnings in test_subprocess. 2011-08-19 05:12:01 +02:00
Charles-François Natali 2736c5d47c Issue #12650: fix failures on some buildbots, when a subprocess takes a long
time to spawn.
2011-08-19 00:25:07 +02:00
Charles-François Natali 72d161af51 Issue #12650: fix failures on some buildbots, when a subprocess takes a long
time to spawn.
2011-08-19 00:24:00 +02:00
Benjamin Peterson c07f3be4e0 merge 3.2 2011-08-18 13:55:31 -05: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 114f0e499d Issue #12607: Merge with 3.2. 2011-07-27 07:39:27 +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 5351a1f956 (merge 3.2) Issue #12493: skip test_communicate_eintr() if signal.SIGALRM is missing 2011-07-05 14:50:08 +02:00
Victor Stinner 1848db891b Issue #12493: skip test_communicate_eintr() if signal.SIGALRM is missing 2011-07-05 14:49:46 +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 8153b7a57a (merge 3.2) Issue #12383: skip test_empty_env() of subprocess on Windows
Cannot test an empty environment on Windows: Windows requires at least the
SYSTEMROOT environment variable to start Python.
2011-06-23 01:02:50 +02:00
Victor Stinner 62d511809d Issue #12383: skip test_empty_env() of subprocess on Windows
Cannot test an empty environment on Windows: Windows requires at least the
SYSTEMROOT environment variable to start Python.
2011-06-23 01:02:25 +02:00
Victor Stinner c0a9f75fba (merge 3.2) Issue #12383: fix test_empty_env() of subprocess on Mac OS X
Mac OS X adds __CF_USER_TEXT_ENCODING variable to an empty environment. Fix
also the test on the Py_ENABLE_SHARED config varible: test that the variable is
present, don't check it's value.
2011-06-22 21:29:07 +02:00
Victor Stinner 237e5cb376 Issue #12383: fix test_empty_env() of subprocess on Mac OS X
Mac OS X adds __CF_USER_TEXT_ENCODING variable to an empty environment. Fix
also the test on the Py_ENABLE_SHARED config varible: test that the variable is
present, don't check it's value.
2011-06-22 21:28:43 +02:00
Victor Stinner 11cc475be7 (merge 3.2) Issue #12383: skip test_empty_env() if compiled is compiled in
shared mode

Try also to get more informations about the Mac OS X failure: display the keys
of the environment, instead of just the number of variables.
2011-06-21 21:59:51 +02:00
Victor Stinner 372309a551 Issue #12383: skip test_empty_env() if compiled is compiled in shared mode
Try also to get more informations about the Mac OS X failure: display the keys
of the environment, instead of just the number of variables.
2011-06-21 21:59:06 +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 149b1c7797 Use a sleep for test_subprocess timeout test
instead of an active loop (while True: pass) to limit race conditions.
2011-06-06 23:43:02 +02:00
Victor Stinner ebbbdafd87 (Merge 3.2) Close #12230: Mac OS X Tiger (10.4) has a kernel bug: sometimes,
the file descriptor of a pipe closed in the parent process is valid in the
child process according to fstat(), but the mode of the file descriptor is
invalid, and read or write raise an error.

test.support.requires_mac_ver() is now a decorator, as suggested by Ezio
Melotti, and its docstring is fixed (linux_version => mac_ver).
2011-06-01 13:19:07 +02:00
Victor Stinner 88701e27e9 Close #12230: Mac OS X Tiger (10.4) has a kernel bug: sometimes, the file
descriptor of a pipe closed in the parent process is valid in the child process
according to fstat(), but the mode of the file descriptor is invalid, and read
or write raise an error.

Add also requires_mac_ver() decorator to test.support.
2011-06-01 13:13:04 +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
Charles-François Natali 2d51721832 Issue #12196: Add PIPE_MAX_SIZE to test.support, constant larger than the
underlying OS pipe buffer size.
2011-05-29 16:36:44 +02:00
Gregory P. Smith 8281ba8bcb follow on to the last commit, remove the final POSIXPurePythonTestCase
reference.  (the difference between running test_subprocess.py
directly rather than via regrtest.py)
2011-05-28 10:00:14 -07: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 7439e7b7ce Fix ProcessTestCasePOSIXPurePython to test the module from import when
_posixsubprocess doesn't exist rather than simply stubbing it out
after the fact.  This adds coverage for the RuntimeWarning as well as
using the pure python _create_pipe instead of using
_posixsubprocess.cloexec_pipe unintentionally with the pure python
code.

Ironically: I don't think any platform should ever actually _use_ the
pure Python subprocess code on POSIX platforms anymore.  This at least
tests it properly in this stable branch.  The pure python code for
this is likely to be removed in 3.3.
2011-05-28 09:06:02 -07:00
Gregory P. Smith c80504fb69 Fix ProcessTestCasePOSIXPurePython to test the module from import when
_posixsubprocess doesn't exist rather than simply stubbing it out
after the fact.  This adds coverage for the RuntimeWarning as well as
using the pure python _create_pipe instead of using
_posixsubprocess.cloexec_pipe unintentionally with the pure python
code.

Ironically: I don't think any platform should ever actually _use_ the
pure Python subprocess code on POSIX platforms anymore.  This at least
tests it properly in this stable branch.  The pure python code for
this is likely to be removed in 3.3.
2011-05-28 09:06:02 -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
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
Ross Lagerwall 4aeb542a72 Merge with 3.2 2011-03-26 21:22:09 +02:00
Ross Lagerwall 17ace7a07c Merge with 3.1 2011-03-26 21:21:46 +02:00
Ross Lagerwall b8a5769a6d Issue #11659: Fix ResourceWarning in test_subprocess introduced by #11459.
Patch by Ben Hayden.
2011-03-26 21:19:57 +02: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
Antoine Pitrou 126848a2d8 Fix whitespace in test_subprocess 2011-03-15 21:17:10 +01:00
Gregory P. Smith 961e0e85c0 revert the test_main() change from 08daf3ef6509 so that regrtest continues to run this properly. 2011-03-15 15:43:39 -04:00
Gregory P. Smith e14e9c2218 Add unittests demonstrating issue #11432. 2011-03-15 14:55:17 -04:00
Gregory P. Smith de3909da6b merge 141bbcb19c06 2011-03-15 02:13:09 -04:00
Gregory P. Smith 81ce68597c Fix the @test_NNNN_tmp file terds being left in whatever your $PWD was
when test_subprocess was run.
2011-03-15 02:04:11 -04:00
R David Murray 6924bd72f5 Fix whitespace 2011-03-13 22:48:55 -04:00
R David Murray 384069c2e8 Merge fix for #11490 from 3.1. 2011-03-13 22:26:53 -04:00
R David Murray d79210a0e4 #11490: EACCES can also mean command not found 2011-03-13 22:13:09 -04: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 da9ac728a8 Bump up the subprocess timeouts even more. :( 2011-03-16 17:08:21 -04: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
Gregory P. Smith 3b4652e074 revert the test_main() change from 08daf3ef6509 so that regrtest continues to run this properly. 2011-03-15 15:43:39 -04:00
Gregory P. Smith 112bb3ac6a Add unittests demonstrating issue #11432. 2011-03-15 14:55:17 -04:00
Gregory P. Smith 58e317ba92 merge 1579808ef25b 2011-03-15 02:15:13 -04:00
Reid Kleckner 93479ccbf0 Tweak subprocess test timeouts to satisfy the buildbot. 2011-03-14 19:32:41 -04:00
Reid Kleckner 80b92d106e Attempt a larger timeout value to satisfy the buildbots. 2011-03-14 13:34:12 -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
R David Murray 74fb7601ba Merge whitespace fix from 3.2. 2011-03-13 22:49:44 -04:00
R David Murray dcd79a2d15 Merge fix for #11490 from 3.2. 2011-03-13 22:31:35 -04:00
Victor Stinner 7b3b20ad29 Issue #8513: On UNIX, subprocess supports bytes command string. 2011-03-03 12:54:05 +00:00
Marc-André Lemburg 8f36af7a4c Normalize the encoding names for Latin-1 and UTF-8 to
'latin-1' and 'utf-8'.

These are optimized in the Python Unicode implementation
to result in more direct processing, bypassing the codec
registry.

Also see issue11303.
2011-02-25 15:42:01 +00:00
Antoine Pitrou a47c25d74f Merged revisions 88484 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r88484 | antoine.pitrou | 2011-02-21 22:55:48 +0100 (lun., 21 févr. 2011) | 4 lines

  Issue #10826: Prevent sporadic failure in test_subprocess on Solaris due
  to open door files.
........
2011-02-21 21:58:42 +00:00
Antoine Pitrou ce58dc7b16 Issue #10826: Prevent sporadic failure in test_subprocess on Solaris due
to open door files.
2011-02-21 21:55:48 +00:00
Antoine Pitrou dcdc3b4c5d Add some more output 2011-01-03 22:24:52 +00:00
Antoine Pitrou c43ec08baf Temporary debug output for intermittent failures in test_subprocess 2011-01-03 22:12:43 +00:00
Antoine Pitrou 95aaeee59a Add a subprocess test of remapping standard file descriptors (issue #1187). 2011-01-03 21:15:48 +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 faa8c13ef4 test_subprocess: close pipes at the end of test_pipe_cloexec_real_tools() 2011-01-03 16:36:00 +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 773d7dffb1 fix "BytesWarning: str() on a bytes instance" 2010-12-14 15:25:20 +00:00
Gregory P. Smith a80f4fb048 Fix "BytesWarning: str() on a bytes instance" 2010-12-14 15:23:02 +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 b4162305bb refactor the warning test. 2010-12-04 09:59:52 +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
Ezio Melotti 19f2aeba67 Merged revisions 86596 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r86596 | ezio.melotti | 2010-11-20 21:04:17 +0200 (Sat, 20 Nov 2010) | 1 line

  #9424: Replace deprecated assert* methods in the Python test suite.
........
2010-11-21 01:30:29 +00:00
Ezio Melotti b3aedd4862 #9424: Replace deprecated assert* methods in the Python test suite. 2010-11-20 19:04:17 +00:00
Benjamin Peterson 5f78040057 add filename to ENOENT message #4925 2010-11-20 18:07:52 +00:00
Brian Curtin 19a5379c97 Fix a number of ResourceWarnings on Windows due to open pipes. 2010-11-05 17:09:05 +00:00
Brian Curtin 3c6a951cfb Add cleanups to stdout/stderr pipes to remove ResourceWarnings. 2010-11-05 03:58:52 +00:00
Benjamin Peterson cc221b2411 close some more files 2010-10-31 02:06:21 +00:00
Victor Stinner f6782ac0b6 test_subprocess: use surrogateescape error handler to write shell scripts
test_args_string() and test_call_string() create shell scripts including the
path to the Python executable: use surrogateescape to encode paths including
surrogate characters.
2010-10-16 23:46:43 +00:00
Victor Stinner 89f3ad10d2 test_subprocess doesn't need to C locale to test os.environb
Improve also the comment to explain why C locale is needed to test os.environ.
2010-10-14 10:43:31 +00:00
Victor Stinner ebc78d23ef test_subprocess: use C locale to get ascii locale encoding 2010-10-14 10:38:17 +00:00
Victor Stinner 8f6b6b0cc3 Issue #9992: Remove PYTHONFSENCODING environment variable. 2010-10-13 22:02:27 +00:00
Antoine Pitrou a4024e2dd5 Make _kill_process more robust under Windows too (see issue #8432) 2010-09-24 18:57:01 +00:00
Antoine Pitrou 4a5dd5c576 Merged revisions 84909-84913 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r84909 | antoine.pitrou | 2010-09-20 00:46:05 +0200 (lun., 20 sept. 2010) | 3 lines

  Try to fix test_subprocess on "x86 debian parallel 3.x" buildbot
........
  r84910 | antoine.pitrou | 2010-09-20 01:06:53 +0200 (lun., 20 sept. 2010) | 3 lines

  Try to make signal-sending tests in test_subprocess more robust on slow machines
........
  r84911 | antoine.pitrou | 2010-09-20 01:28:30 +0200 (lun., 20 sept. 2010) | 3 lines

  Make error more explicit in test_finalize_with_trace
........
  r84912 | antoine.pitrou | 2010-09-20 02:12:19 +0200 (lun., 20 sept. 2010) | 3 lines

  Try to fix buildbot failure (#9902)
........
  r84913 | antoine.pitrou | 2010-09-20 03:33:21 +0200 (lun., 20 sept. 2010) | 3 lines

  Try a more robust implementation of _kill_process
........
2010-09-20 11:17:39 +00:00
Antoine Pitrou 3d8580f690 Try a more robust implementation of _kill_process 2010-09-20 01:33:21 +00:00
Antoine Pitrou 84e751a442 Try to fix buildbot failure (#9902) 2010-09-20 00:12:19 +00:00
Antoine Pitrou fedd481596 Try to make signal-sending tests in test_subprocess more robust on slow machines 2010-09-19 23:06:53 +00:00
Antoine Pitrou fb8db8f635 Try to fix test_subprocess on "x86 debian parallel 3.x" buildbot 2010-09-19 22:46:05 +00:00
Antoine Pitrou 6fab1f69e2 Merged revisions 84883 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r84883 | antoine.pitrou | 2010-09-19 00:38:48 +0200 (dim., 19 sept. 2010) | 3 lines

  Issue #9895: speed up test_subprocess
........
2010-09-18 22:40:56 +00:00
Antoine Pitrou 8db3027e6a Issue #9895: speed up test_subprocess 2010-09-18 22:38:48 +00:00
Antoine Pitrou f61045fd15 Merged revisions 84878 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r84878 | antoine.pitrou | 2010-09-18 19:56:02 +0200 (sam., 18 sept. 2010) | 5 lines

  Issue #9894: Do not hardcode ENOENT in test_subprocess.

  (GNU/Hurd is not dead)
........
2010-09-18 18:16:39 +00:00
Antoine Pitrou 679e0f2328 Issue #9894: Do not hardcode ENOENT in test_subprocess.
(GNU/Hurd is not dead)
2010-09-18 17:56:02 +00:00
Brian Curtin f263c0594c Merged revisions 83983 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r83983 | brian.curtin | 2010-08-13 15:42:57 -0500 (Fri, 13 Aug 2010) | 3 lines

  Fix #9588. Add sys.executable to two shell=True tests.
........
2010-08-13 20:59:27 +00:00
Brian Curtin d835cf1c84 Fix #9588. Add sys.executable to two shell=True tests. 2010-08-13 20:42:57 +00:00
Tim Golden 595c8d34a3 #2304: fix incorporating Eric Smith's .format suggestion and tested on Ubuntu as well as Windows 2010-08-12 09:45:25 +00:00
Tim Golden 126c2960ca #2304: fix incorporating Eric Smith's .format suggestion and tested on Ubuntu as well as Windows 2010-08-11 14:20:40 +00:00
Benjamin Peterson a0baf55b2b revert r83831, unix test breakage 2010-08-08 19:17:15 +00:00
Benjamin Peterson 1a0a737b13 revert r83830, breaks tests on unixes 2010-08-08 19:08:44 +00:00
Tim Golden 818afb55c9 Issue #2304: Add additional quotes when using cmd shell on Windows. Original patch from Gabriel Genellina 2010-08-08 16:18:18 +00:00
Tim Golden e3f76168a9 Issue #2304: Add additional quotes when using cmd shell on Windows. Original patch from Gabriel Genellina 2010-08-08 16:17:48 +00:00
Tim Golden 40b3744efa Issue #3210: Ensure stdio handles are closed if CreateProcess fails 2010-08-06 13:20:12 +00:00
Tim Golden af5ac3974b Issue #3210: Ensure stdio handles are closed if CreateProcess fails 2010-08-06 13:03:56 +00:00