summaryrefslogtreecommitdiffstats
path: root/Lib/subprocess.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-05-24 00:50:02 (GMT)
committerGuido van Rossum <guido@python.org>2007-05-24 00:50:02 (GMT)
commitc2f93dc2e42b48a20578599407b0bb51a6663d09 (patch)
treea13677daceceb29f55a468cac3874e1a757dccc9 /Lib/subprocess.py
parentd8595fe304c3d9bb15ad59b1db0b71a2b7ab3c54 (diff)
downloadcpython-c2f93dc2e42b48a20578599407b0bb51a6663d09.zip
cpython-c2f93dc2e42b48a20578599407b0bb51a6663d09.tar.gz
cpython-c2f93dc2e42b48a20578599407b0bb51a6663d09.tar.bz2
Remove native popen() and fdopen(), replacing them with subprocess calls.
Fix a path to an assert in fileio_read(). Some misc tweaks.
Diffstat (limited to 'Lib/subprocess.py')
-rw-r--r--Lib/subprocess.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index 2d02df6..fe64cc0 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -246,11 +246,11 @@ A more real-world example would look like this:
try:
retcode = call("mycmd" + " myarg", shell=True)
if retcode < 0:
- print >>sys.stderr, "Child was terminated by signal", -retcode
+ print("Child was terminated by signal", -retcode, file=sys.stderr)
else:
- print >>sys.stderr, "Child returned", retcode
-except OSError, e:
- print >>sys.stderr, "Execution failed:", e
+ print("Child returned", retcode, file=sys.stderr)
+except OSError as e:
+ print("Execution failed:", e, file=sys.stderr)
Replacing os.spawn*
@@ -539,6 +539,8 @@ class Popen(object):
os.close(errread)
errread = None
+ if bufsize == 0:
+ bufsize = 1 # Nearly unbuffered (XXX for now)
if p2cwrite is not None:
self.stdin = os.fdopen(p2cwrite, 'wb', bufsize)
if c2pread is not None:
@@ -1007,6 +1009,7 @@ class Popen(object):
if data:
os.waitpid(self.pid, 0)
child_exception = pickle.loads(data)
+ print("exc:", child_exception)
raise child_exception