diff options
Diffstat (limited to 'Lib/os.py')
-rw-r--r-- | Lib/os.py | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -974,7 +974,7 @@ otherwise return -SIG, where SIG is the signal that killed it. """ # command in a shell can't be supported. if sys.platform != 'vxworks': # Supply os.popen() - def popen(cmd, mode="r", buffering=-1): + def popen(cmd, mode="r", buffering=-1, encoding=None): if not isinstance(cmd, str): raise TypeError("invalid cmd type (%s, expected string)" % type(cmd)) if mode not in ("r", "w"): @@ -982,6 +982,7 @@ if sys.platform != 'vxworks': if buffering == 0 or buffering is None: raise ValueError("popen() does not support unbuffered streams") import subprocess, io + encoding = io.text_encoding(encoding) if mode == "r": proc = subprocess.Popen(cmd, shell=True, text=True, |