diff options
author | Fred Drake <fdrake@acm.org> | 2000-08-28 17:20:05 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2000-08-28 17:20:05 (GMT) |
commit | 31f182e830db13c3edbe12e58f9c737cc21583fa (patch) | |
tree | 6138744d553c71b9eef48a43bc8a4ab201c5f9c3 /Lib/popen2.py | |
parent | e67d8e514f7d7b49faec3e5a181c7019f07467ba (diff) | |
download | cpython-31f182e830db13c3edbe12e58f9c737cc21583fa.zip cpython-31f182e830db13c3edbe12e58f9c737cc21583fa.tar.gz cpython-31f182e830db13c3edbe12e58f9c737cc21583fa.tar.bz2 |
Added os.popen2() and os.popen3() for non-Windows platforms.
Diffstat (limited to 'Lib/popen2.py')
-rw-r--r-- | Lib/popen2.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/popen2.py b/Lib/popen2.py index 2fd9a19..e0f2880 100644 --- a/Lib/popen2.py +++ b/Lib/popen2.py @@ -89,7 +89,8 @@ class Popen3: _active.remove(self) return self.sts -if hasattr(os, "popen2"): + +if sys.platform[:3] == "win": def popen2(cmd, mode='t', bufsize=-1): """Execute the shell command 'cmd' in a sub-process. If 'bufsize' is specified, it sets the buffer size for the I/O pipes. The file objects @@ -109,7 +110,7 @@ else: inst = Popen3(cmd, 0, bufsize) return inst.fromchild, inst.tochild -if hasattr(os, "popen3"): +if sys.platform[:3] == "win": def popen3(cmd, mode='t', bufsize=-1): """Execute the shell command 'cmd' in a sub-process. If 'bufsize' is specified, it sets the buffer size for the I/O pipes. The file objects @@ -129,7 +130,7 @@ else: inst = Popen3(cmd, 1, bufsize) return inst.fromchild, inst.tochild, inst.childerr -if hasattr(os, "popen4"): +if sys.platform[:3] == "win": def popen4(cmd, mode='t', bufsize=-1): """Execute the shell command 'cmd' in a sub-process. If 'bufsize' is specified, it sets the buffer size for the I/O pipes. The file objects @@ -139,6 +140,7 @@ if hasattr(os, "popen4"): else: pass # not yet on unix + def _test(): cmd = "cat" teststr = "abc\n" |