Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions labgrid/util/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ProcessWrapper:
loglevel = logging.INFO

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

process = subprocess.Popen(command, stderr=sfd,
if stderr is None:
stderr = sfd

process = subprocess.Popen(command, stderr=stderr,
stdout=sfd, bufsize=0, **kwargs)

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