summaryrefslogtreecommitdiff
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2000-09-19 03:04:52 +0000
committerGuido van Rossum <guido@python.org>2000-09-19 03:04:52 +0000
commitd9a8e965433e03f598089153f3c51ac6d6fb295f (patch)
tree65d013bd3467e29df34c4954d4b25e669459e815 /Lib
parent9e8181b809c0dc40f86d66ce7e51db83aaeccd20 (diff)
downloadcpython-git-d9a8e965433e03f598089153f3c51ac6d6fb295f.tar.gz
Only supply popen2, popen3 when fork exists.
(This avoids defining non-working versions of these on the Mac.)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/os.py28
1 files changed, 15 insertions, 13 deletions
diff --git a/Lib/os.py b/Lib/os.py
index c804c3ab86..70af0a9406 100644
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -454,16 +454,18 @@ otherwise return -SIG, where SIG is the signal that killed it. """
return spawnvpe(mode, file, args[:-1], env)
-if not _exists("popen2"):
- def popen2(cmd, mode="t", bufsize=-1):
- assert mode[:1] in ("b", "t")
- import popen2
- stdout, stdin = popen2.popen2(cmd, bufsize)
- return stdin, stdout
-
-if not _exists("popen3"):
- def popen3(cmd, mode="t", bufsize=-1):
- assert mode[:1] in ("b", "t")
- import popen2
- stdout, stdin, stderr = popen2.popen3(cmd, bufsize)
- return stdin, stdout, stderr
+# Supply popen2 etc. (for Unix)
+if _exists("fork"):
+ if not _exists("popen2"):
+ def popen2(cmd, mode="t", bufsize=-1):
+ assert mode[:1] in ("b", "t")
+ import popen2
+ stdout, stdin = popen2.popen2(cmd, bufsize)
+ return stdin, stdout
+
+ if not _exists("popen3"):
+ def popen3(cmd, mode="t", bufsize=-1):
+ assert mode[:1] in ("b", "t")
+ import popen2
+ stdout, stdin, stderr = popen2.popen3(cmd, bufsize)
+ return stdin, stdout, stderr