Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 20af317

Browse files
committed
popen4(): Added for Unix.
Fixed a typo in a docstring.
1 parent d75e63a commit 20af317

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

Lib/os.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ def update(self, dict):
317317
def getenv(key, default=None):
318318
"""Get an environment variable, return None if it doesn't exist.
319319
320-
The optional second argument can specify an alternative default."""
320+
The optional second argument can specify an alternate default."""
321321
return environ.get(key, default)
322322

323323
def _exists(name):
@@ -458,14 +458,18 @@ def spawnlpe(mode, file, *args):
458458
if _exists("fork"):
459459
if not _exists("popen2"):
460460
def popen2(cmd, mode="t", bufsize=-1):
461-
assert mode[:1] in ("b", "t")
462461
import popen2
463462
stdout, stdin = popen2.popen2(cmd, bufsize)
464463
return stdin, stdout
465464

466465
if not _exists("popen3"):
467466
def popen3(cmd, mode="t", bufsize=-1):
468-
assert mode[:1] in ("b", "t")
469467
import popen2
470468
stdout, stdin, stderr = popen2.popen3(cmd, bufsize)
471469
return stdin, stdout, stderr
470+
471+
if not _exists("popen4"):
472+
def popen4(cmd, mode="t", bufsize=-1):
473+
import popen2
474+
stdout, stdin = popen2.popen4(cmd, bufsize)
475+
return stdin, stdout

0 commit comments

Comments
 (0)