mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Added os.popen2() and os.popen3() for non-Windows platforms.
This commit is contained in:
parent
e67d8e514f
commit
31f182e830
4 changed files with 57 additions and 4 deletions
13
Lib/os.py
13
Lib/os.py
|
@ -454,3 +454,16 @@ 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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue