Commit Graph

181 Commits

Author SHA1 Message Date
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
Gregory P. Smith 02dee1acd8 Fixes issue #15756: subprocess.poll() now properly handles errno.ECHILD
to return a returncode of 0 when the child has already exited or cannot be
waited on.
2012-09-29 11:53:08 -07:00
Gregory P. Smith 3905171f1e Fixes issue #15756: subprocess.poll() now properly handles errno.ECHILD
to return a returncode of 0 when the child has already exited or cannot
be waited on.
2012-09-29 11:40:38 -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 377a152e0d Use Thread.is_alive() instead of old-style Thread.isAlive() in subprocess. 2012-08-19 20:49:39 +03:00
Andrew Svetlov 592df20efc Cleanup universal_newlines usage for subprocess.Popen, remove unused param. 2012-08-15 17:36:15 +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
Victor Stinner 949d8c986e Close #14690: Use monotonic clock instead of system clock in the sched,
subprocess and trace modules.
2012-05-30 13:30:32 +02:00
Vinay Sajip 7ded1f0f69 Implemented PEP 405 (Python virtual environments). 2012-05-26 03:45:29 +01:00
Antoine Pitrou ebdcd859e5 Move private function _args_from_interpreter_flags() to subprocess.py, so
that it can be imported when threads are disabled.
(followup to issue #12098)
2012-05-18 18:33:07 +02:00
Antoine Pitrou 23bba4ca39 Issue #11750: The Windows API functions scattered in the _subprocess and
_multiprocessing.win32 modules now live in a single module "_winapi".
Patch by sbt.
2012-04-18 20:51:15 +02: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
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