Skip to content
Merged
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
26 changes: 12 additions & 14 deletions bionetgen/core/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,20 +655,18 @@ def run_command(command, suppress=True, timeout=None, cwd=None):
be killed.
"""
if timeout is not None:
if suppress:
# I am unsure how to do both timeout and the live polling of stdo
rc = subprocess.run(
command,
timeout=timeout,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
cwd=cwd,
)
return rc.returncode, rc
else:
# I am unsure how to do both timeout and the live polling of stdo
rc = subprocess.run(command, timeout=timeout, capture_output=True, cwd=cwd)
return rc.returncode, rc
# Always capture stdout/stderr — this lets callers (notably BNGCLI)
# surface BNG2.pl's error tail in BNGRunError when the command
# fails. With timeout set, subprocess.run buffers all output
# anyway, so suppress=True vs False makes no behavioral difference
# for the user during the run.
rc = subprocess.run(
command,
timeout=timeout,
capture_output=True,
cwd=cwd,
)
return rc.returncode, rc
else:
if suppress:
process = subprocess.Popen(
Expand Down
Loading