Commit 8faa072f authored by Philip Jenvey's avatar Philip Jenvey

Merged revisions 72817 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r72817 | philip.jenvey | 2009-05-21 22:35:32 -0700 (Thu, 21 May 2009) | 4 lines

  don't use subprocess.call with PIPEs as the child can fill the pipe buf and
  deadlock. add a warning to subprocess docs about this, similar to Popen.wait's.
  refs http://bugs.jython.org/issue1351
........
parent e5990e40
...@@ -152,6 +152,12 @@ This module also defines four shortcut functions: ...@@ -152,6 +152,12 @@ This module also defines four shortcut functions:
retcode = call(["ls", "-l"]) retcode = call(["ls", "-l"])
.. warning::
Like :meth:`Popen.wait`, this will deadlock if the child process
generates enough output to a stdout or stderr pipe such that it blocks
waiting for the OS pipe buffer to accept more data.
.. function:: check_call(*popenargs, **kwargs) .. function:: check_call(*popenargs, **kwargs)
...@@ -164,6 +170,10 @@ This module also defines four shortcut functions: ...@@ -164,6 +170,10 @@ This module also defines four shortcut functions:
check_call(["ls", "-l"]) check_call(["ls", "-l"])
.. warning::
See the warning for :func:`call`.
.. function:: check_output(*popenargs, **kwargs) .. function:: check_output(*popenargs, **kwargs)
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
# All tests are executed with environment variables ignored # All tests are executed with environment variables ignored
# See test_cmd_line_script.py for testing of script execution # See test_cmd_line_script.py for testing of script execution
import os
import test.support, unittest import test.support, unittest
import os import os
import sys import sys
...@@ -40,8 +41,9 @@ class CmdLineTest(unittest.TestCase): ...@@ -40,8 +41,9 @@ class CmdLineTest(unittest.TestCase):
def exit_code(self, *args): def exit_code(self, *args):
cmd_line = [sys.executable, '-E'] cmd_line = [sys.executable, '-E']
cmd_line.extend(args) cmd_line.extend(args)
return subprocess.call(cmd_line, stdout=subprocess.PIPE, with open(os.devnull, 'w') as devnull:
stderr=subprocess.PIPE) return subprocess.call(cmd_line, stdout=devnull,
stderr=subprocess.STDOUT)
def test_directories(self): def test_directories(self):
self.assertNotEqual(self.exit_code('.'), 0) self.assertNotEqual(self.exit_code('.'), 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment