Commit d9a8e965 authored by Guido van Rossum's avatar Guido van Rossum

Only supply popen2, popen3 when fork exists.

(This avoids defining non-working versions of these on the Mac.)
parent 9e8181b8
...@@ -454,14 +454,16 @@ otherwise return -SIG, where SIG is the signal that killed it. """ ...@@ -454,14 +454,16 @@ otherwise return -SIG, where SIG is the signal that killed it. """
return spawnvpe(mode, file, args[:-1], env) return spawnvpe(mode, file, args[:-1], env)
if not _exists("popen2"): # Supply popen2 etc. (for Unix)
if _exists("fork"):
if not _exists("popen2"):
def popen2(cmd, mode="t", bufsize=-1): def popen2(cmd, mode="t", bufsize=-1):
assert mode[:1] in ("b", "t") assert mode[:1] in ("b", "t")
import popen2 import popen2
stdout, stdin = popen2.popen2(cmd, bufsize) stdout, stdin = popen2.popen2(cmd, bufsize)
return stdin, stdout return stdin, stdout
if not _exists("popen3"): if not _exists("popen3"):
def popen3(cmd, mode="t", bufsize=-1): def popen3(cmd, mode="t", bufsize=-1):
assert mode[:1] in ("b", "t") assert mode[:1] in ("b", "t")
import popen2 import popen2
......
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