Commit Graph

99 Commits

Author SHA1 Message Date
Charles-François Natali 2a34eb3104 Issue #12786: Set communication pipes used by subprocess.Popen CLOEXEC to avoid
them being inherited by other subprocesses.
2011-08-25 21:20:54 +02:00
Charles-François Natali b02302c5cf Issue #12650: Fix a race condition where a subprocess.Popen could leak
resources (FD/zombie) when killed at the wrong time.
2011-08-18 17:18:28 +02:00
Ross Lagerwall d8e3901478 Issue #12607: In subprocess, fix issue where if stdin, stdout or stderr is
given as a low fd, it gets overwritten.
2011-07-27 18:54:53 +02:00
Victor Stinner e790131dc6 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:08:01 +02:00
Victor Stinner 776e69b5b3 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 01:03:00 +02:00
Brian Curtin 20de4586e6 whitespace fix 2011-04-29 16:28:52 -05:00
Brian Curtin 77b75910b7 merge 2011-04-29 16:21:51 -05:00
Ross Lagerwall 104c3f1020 Issue #10963: Ensure that subprocess.communicate() never raises EPIPE. 2011-04-05 15:24:34 +02:00
Ezio Melotti c2077b0d9b #11565: Fix several typos. Patch by Piotr Kasprzyk. 2011-03-16 12:34:31 +02:00
Antoine Pitrou 91ce0d933c 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:45:09 +00:00
Gregory P. Smith 312efbc115 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:02:53 +00:00
Brian Curtin e80513c207 Merged revisions 84582 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r84582 | brian.curtin | 2010-09-07 08:24:38 -0500 (Tue, 07 Sep 2010) | 3 lines

  Adjust #8956 to add the bad signal number to the exception message.
........
2010-09-07 13:27:20 +00:00
Brian Curtin 9a0cb6a8d0 Merged revisions 84559 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r84559 | brian.curtin | 2010-09-06 11:29:29 -0500 (Mon, 06 Sep 2010) | 6 lines

  Fix #8956. ValueError message was only mentioning one signal.

  Rather than list out the three signals (or more over time), the message was
  made less specific but still descriptive.
........
2010-09-06 16:31:27 +00:00
Tim Golden 8e4756c763 #2304: fix incorporating Eric Smith's .format suggestion and tested on Ubuntu as well as Windows 2010-08-12 11:00:35 +00:00
Benjamin Peterson 718f222372 revert 83832; unix test breakage 2010-08-08 19:14:28 +00:00
Tim Golden 6fe8c41e8f Issue #2304: Add additional quotes when using cmd shell on Windows. Original patch from Gabriel Genellina 2010-08-08 16:18:45 +00:00
Tim Golden 431774f32a Issue #3210: Revert C module changes and apply patch from Hirokazu Yamamoto instead 2010-08-08 11:17:56 +00:00
Stefan Krah e9a6a7dd4c Issue #9265: Incorrect name passed as arg[0] when shell=True
and executable specified.
2010-07-19 14:41:08 +00:00
Jean-Paul Calderone b33f0c1ccd Revert r60115
This revision introduced quoting for strings containing | based
on a misunderstanding of the commonly used quoting rules used
on Windows.

| is interpreted by cmd.exe, not by the MS C runtime argv initializer.
It only needs to be quoted if it is part of an argument passed through
cmd.exe.

See issue1300, issue7839, and issue8972.
2010-06-18 20:00:17 +00:00
Victor Stinner 2b271f7e30 Fix regression introduced by r81154 (Issue #5099, subprocess destructor) 2010-05-14 21:52:26 +00:00
Brett Cannon 42a0ba7b2c subprocess.Popen.__del__ referenced global objects, which is a no-no thanks to
interpreter shutdown semantics. Same issue goes for the methods that __del__
called. Now all the methods capture the global objects it needs as default
values to private parameters (could have stuck them on the class object itself,
but since the objects have nothing directly to do with the class that seemed
wrong).

There is no test as making one that works is hard. This patch was
verified against a consistently failing test in Mercurial's test suite, though,
so it has been tested in some regard.

Closes issue #5099. Thanks to Mary Stern for the bug report and Gabriel
Genellina for writing another patch for the same issue and attempting to write
a test.
2010-05-14 00:21:48 +00:00
Brett Cannon 3d6137962c Revert an accidental commit from r80492. 2010-04-25 23:11:51 +00:00
Brett Cannon 1994969c15 When DeprecationWarning was silenced by default, it also silenced any use of -Q
by default as well. This change fixes that by treating -Q like -3 when it comes
to DeprecationWarning; using it causes the silencing to not occur.

Fixes issue #7319.
2010-04-25 22:33:36 +00:00
Brian Curtin a2936cfa09 Fix #7838. Add docstrings and privatize _subprocess implementation details.
Since CREATE_NEW_* are used for the creation flags of a subprocess, they
were added to __all__. The rest of the previously exposed attributes are
now qualified by _subprocess.ATTR rather than importing *.
2010-04-24 15:40:11 +00:00
Brian Curtin e5aa886b44 Implement #1220212. Add os.kill support for Windows.
os.kill takes one of two newly added signals, CTRL_C_EVENT and
CTRL_BREAK_EVENT, or any integer value. The events are a special case
which work with subprocess console applications which implement a
special console control handler. Any other value but those two will
cause os.kill to use TerminateProcess, outright killing the process.

This change adds win_console_handler.py, which is a script to implement
SetConsoleCtrlHandler and applicable handler function, using ctypes.

subprocess also gets another attribute which is a necessary flag to
creationflags in Popen in order to send the CTRL events.
2010-04-02 23:26:06 +00:00
Florent Xicluna cf741ceb69 Fix syntax: "rc != None" -> "rc is not None" 2010-03-08 10:58:12 +00:00
Gregory P. Smith cce211f88c Issue #1068268: The subprocess module now handles EINTR in internal
os.waitpid and os.read system calls where appropriate.
2010-03-01 00:05:08 +00:00
Georg Brandl 84fedf7f06 No need to assign the results of expressions used only for side effects. 2010-02-06 22:59:15 +00:00
Georg Brandl 02e7dfde63 #7381: consistency update, and backport avoiding ``None >= 0`` check from py3k. 2009-12-28 08:09:32 +00:00
Georg Brandl 6ab5d083f2 #7381: subprocess documentation and library docstring consistency fixes. 2009-12-20 14:33:20 +00:00
Eric Smith d19915ed76 Issue 7294: Fixed URL in a comment. 2009-11-09 15:16:23 +00:00
Philip Jenvey 8b9020458a #5329: fix os.popen* regression from 2.5: don't execute commands as a sequence
through the shell. also document the correct subprocess replacement for this
case
patch from Jean-Paul Calderone and Jani Hakala
2009-09-29 19:10:15 +00:00
Georg Brandl 3e8b869c9c Revert r74028. 2009-07-16 21:47:51 +00:00
Georg Brandl 3601a38029 #6482: simplify "except: raise" to "finally:". 2009-07-16 19:24:48 +00:00
Amaury Forgeot d'Arc 8318afa0b8 #6447: typo in subprocess docstring 2009-07-10 16:47:42 +00:00
Amaury Forgeot d'Arc ce32eb7406 #6416: Fix compilation of the select module on Windows, as well as test_subprocess:
PIPE_BUF is not defined on Windows, and probably has no meaning there.

Anyway the subprocess module uses another way to perform non-blocking reads (with a thread)
2009-07-09 22:37:22 +00:00
Gregory P. Smith dd7ca24eb5 Use select.poll() in subprocess, when available, rather than select() so that
it does not fail when file descriptors are large.  Fixes issue3392.

Patch largely contributed by Frank Chu (fpmc) with some improvements by me.
See http://bugs.python.org/issue3392.

Candidate for backporting to release26-maint as it is a bug fix and changes no
public API.
2009-07-04 01:49:29 +00:00
Facundo Batista 8c826b77e0 Issue #6274. Fixed a potential FD leak in subprocess.py. 2009-06-19 18:02:28 +00:00
Amaury Forgeot d'Arc 5fe420e34c #6189: The subprocess.py module should be kept compatible with python 2.2
(On windows, you still have to change one line to use pywin32
instead of the _subprocess helper module)
2009-06-18 22:32:50 +00:00
Hirokazu Yamamoto eacbbdfb73 Issue #5179: Fixed subprocess handle leak on failure on windows. 2009-03-03 22:18:14 +00:00
Mark Dickinson 3e4caeb3bf Issue #5341: Fix a variety of spelling errors. 2009-02-21 20:27:01 +00:00
Georg Brandl f3715d2fc7 #5179: don't leak PIPE fds when child execution fails. 2009-02-14 17:01:36 +00:00
Gregory P. Smith 26576801a6 rename the new check_call_output to check_output. its less ugly. 2008-12-05 02:27:01 +00:00
Gregory P. Smith 97f49f4be7 Adds a subprocess.check_call_output() function to return the output from a
process on success or raise an exception on error.
2008-12-04 20:21:09 +00:00
Brett Cannon 03446c43ca Remove warnings generated for the suprocess module when run under -3. Required
commenting out True/False compatbility stuff, remove a use of apply(), and
remove a use of buffer() (just pulled the solution used in 3.0 which is direct
slicing).
2008-08-08 04:19:32 +00:00
Gregory P. Smith a36f8fefb0 - Issue #1857: subprocess.Popen.poll gained an additional _deadstate keyword
argument in python 2.5, this broke code that subclassed Popen to include its
  own poll method.  Fixed my moving _deadstate to an _internal_poll method.
2008-08-04 00:13:29 +00:00
Gregory P. Smith f41406409e - Issue #2113: Fix error in subprocess.Popen if the select system call is
interrupted by a signal.
2008-07-06 07:16:40 +00:00
Gregory P. Smith 4036fd4b75 Fixes issue2791: subprocess.Popen.communicate leaked a file descripton until
the last reference to the Popen instance was dropped.  Adding explicit
close() calls fixes it.

Candidate for backport to release25-maint.
2008-05-26 20:22:14 +00:00
Christian Heimes e74c8f2879 Added kill, terminate and send_signal to subprocess.Popen
The bits and pieces for the Windows side were already in place. The POSIX side is trivial (as usual) and uses os.kill().
2008-04-19 02:23:57 +00:00
Gregory P. Smith 70eb2f91b4 Fix issue 1300: Quote command line arguments that contain a '|' character in
subprocess.list2cmdline (windows).
2008-01-19 22:49:37 +00:00