Commit Graph

203 Commits

Author SHA1 Message Date
Andrew Svetlov f7a17b48d7 Replace IOError with OSError (#16715) 2012-12-25 16:47:37 +02:00
Andrew Svetlov 1d960fe4c4 Keep ref to ECHILD in local scope (#16650) 2012-12-24 20:08:53 +02:00
Andrew Svetlov 5b187ce700 Keep ref to ECHILD in local scope (#16650) 2012-12-24 20:06:52 +02:00
Andrew Svetlov 08bab07291 Keep ref to ECHILD in local scope (#16650) 2012-12-24 20:06:35 +02:00
Brian Curtin 445ad997ab Fix #14470. Remove w9xpopen per PEP 11.
As stated in PEP 11, 3.4 removes code on Windows platforms where
COMSPEC points to command.com. The w9xpopen project in Visual Studio
was added to support that case, and there was a special case in subprocess
to cover that situation. This change removes the w9xpopen project from
the Visual Studio solution and removes any references to the w9xpopen
executable.
2012-12-23 16:53:21 -06:00
Andrew Svetlov ad28c7f9da Issue #16706: get rid of os.error 2012-12-18 22:02:39 +02:00
Andrew Svetlov 3438fa496d Get rig of EnvironmentError (#16705) 2012-12-17 23:35:18 +02:00
Andrew Svetlov 6d8a122b9c Issue #16704: Get rid of select.error in stdlib. Use OSError instead. 2012-12-17 22:23:46 +02:00
Andrew Svetlov df485ca493 Remove obsolete code: now IOError and WindowsError are aliases for OSError 2012-12-17 16:15:35 +02: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 d4b645ef42 Remove the subprocess "bad exception data" warning (formerly a print!)
all together and just include the repr of the data in the exception
itself instead of the useless string "Unknown".

This code path is unlikely to even be possible to take given the
nature of the pipe it gets subprocess data from.
2012-11-11 00:08:45 -08:00
Gregory P. Smith 6893732c35 Remove the subprocess "bad exception data" warning (formerly a print!)
all together and just include the repr of the data in the exception
itself instead of the useless string "Unknown".

This code path is unlikely to even be possible to take given the
nature of the pipe it gets subprocess data from.
2012-11-11 00:04:52 -08:00
Gregory P. Smith 3aee222122 Remove the subprocess "bad exception data" warning (formerly a print!)
all together and just include the repr of the data in the exception
itself instead of the useless string "Unknown".

This code path is unlikely to even be possible to take given the
nature of the pipe it gets subprocess data from.
2012-11-11 00:04:13 -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 1f83866ecd Rename a local variable for readability and change a "this can't
happen" print() call into a RuntimeWarning as it should've been in the
first place.  Because nothing should ever cause unexpected stdout output.
2012-11-10 23:33:56 -08:00
Gregory P. Smith f44c9da166 Rename a local variable for readability and change a "this can't
happen" print() call into a RuntimeWarning as it should've been in the
first place.  Because nothing should ever cause unexpected stdout output.
2012-11-10 23:33:17 -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 f328d79223 Fixes issue #14396: Handle the odd rare case of waitpid returning 0
when not expected in subprocess.Popen.wait().
2012-11-10 21:06:18 -08:00
Gregory P. Smith 2ec82331b2 Fixes issue #14396: Handle the odd rare case of waitpid returning 0 when
not expected in subprocess.Popen.wait().
2012-11-10 20:52:29 -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
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