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

Skip to content

Commit b5aa407

Browse files
committed
Use Boolean values for the capturestderr flag.
1 parent 70fedcd commit b5aa407

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Lib/popen2.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Popen3:
2525

2626
sts = -1 # Child not completed yet
2727

28-
def __init__(self, cmd, capturestderr=0, bufsize=-1):
28+
def __init__(self, cmd, capturestderr=False, bufsize=-1):
2929
"""The parameter 'cmd' is the shell command to execute in a
3030
sub-process. The 'capturestderr' flag, if true, specifies that
3131
the object should capture standard error output of the child process.
@@ -141,14 +141,14 @@ def popen2(cmd, bufsize=-1, mode='t'):
141141
"""Execute the shell command 'cmd' in a sub-process. If 'bufsize' is
142142
specified, it sets the buffer size for the I/O pipes. The file objects
143143
(child_stdout, child_stdin) are returned."""
144-
inst = Popen3(cmd, 0, bufsize)
144+
inst = Popen3(cmd, False, bufsize)
145145
return inst.fromchild, inst.tochild
146146

147147
def popen3(cmd, bufsize=-1, mode='t'):
148148
"""Execute the shell command 'cmd' in a sub-process. If 'bufsize' is
149149
specified, it sets the buffer size for the I/O pipes. The file objects
150150
(child_stdout, child_stdin, child_stderr) are returned."""
151-
inst = Popen3(cmd, 1, bufsize)
151+
inst = Popen3(cmd, True, bufsize)
152152
return inst.fromchild, inst.tochild, inst.childerr
153153

154154
def popen4(cmd, bufsize=-1, mode='t'):

0 commit comments

Comments
 (0)