Skip to content

Commit c6430e2

Browse files
committed
util/helper: add stderr param to ProcessWrapper
Signed-off-by: Marius Braets <marius.braets@cea.fr>
1 parent 0c01c19 commit c6430e2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

labgrid/util/helper.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class ProcessWrapper:
4040
loglevel = logging.INFO
4141

4242
@step(args=['command'], result=True, tag='process')
43-
def check_output(self, command, *, print_on_silent_log=False, input=None, stdin=None): # pylint: disable=redefined-builtin
43+
def check_output(self, command, *, print_on_silent_log=False, input=None, stdin=None, stderr=None): # pylint: disable=redefined-builtin
4444
"""Run a command and supply the output to callback functions"""
4545
logger = logging.getLogger("Process")
4646
res = []
@@ -58,7 +58,10 @@ def check_output(self, command, *, print_on_silent_log=False, input=None, stdin=
5858
elif stdin is not None:
5959
kwargs['stdin'] = stdin
6060

61-
process = subprocess.Popen(command, stderr=sfd,
61+
if stderr is None:
62+
stderr = sfd
63+
64+
process = subprocess.Popen(command, stderr=stderr,
6265
stdout=sfd, bufsize=0, **kwargs)
6366

6467
logger.log(ProcessWrapper.loglevel, "[%d] command: %s", process.pid, " ".join(command))

0 commit comments

Comments
 (0)