mirror of https://github.com/python/cpython.git
Only supply popen2, popen3 when fork exists.
(This avoids defining non-working versions of these on the Mac.)
This commit is contained in:
parent
9e8181b809
commit
d9a8e96543
26
Lib/os.py
26
Lib/os.py
|
@ -454,16 +454,18 @@ def spawnlpe(mode, file, *args):
|
||||||
return spawnvpe(mode, file, args[:-1], env)
|
return spawnvpe(mode, file, args[:-1], env)
|
||||||
|
|
||||||
|
|
||||||
if not _exists("popen2"):
|
# Supply popen2 etc. (for Unix)
|
||||||
def popen2(cmd, mode="t", bufsize=-1):
|
if _exists("fork"):
|
||||||
assert mode[:1] in ("b", "t")
|
if not _exists("popen2"):
|
||||||
import popen2
|
def popen2(cmd, mode="t", bufsize=-1):
|
||||||
stdout, stdin = popen2.popen2(cmd, bufsize)
|
assert mode[:1] in ("b", "t")
|
||||||
return stdin, stdout
|
import popen2
|
||||||
|
stdout, stdin = popen2.popen2(cmd, bufsize)
|
||||||
|
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
|
||||||
stdout, stdin, stderr = popen2.popen3(cmd, bufsize)
|
stdout, stdin, stderr = popen2.popen3(cmd, bufsize)
|
||||||
return stdin, stdout, stderr
|
return stdin, stdout, stderr
|
||||||
|
|
Loading…
Reference in New Issue