diff options
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" |