Skip to content

Commit 9428beb

Browse files
committed
Take stdin from /dev/null if we have no data to send to processes
This should prevent a test "hanging" while waiting for user input.
1 parent 90afd35 commit 9428beb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

osgtest/library/core.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,9 @@ def __format_command(command):
500500
return result
501501

502502

503+
_devnull = open(os.devnull, "r+b")
504+
505+
503506
def __run_command(command, use_test_user, a_input, a_stdout, a_stderr, log_output=True, shell=False, timeout=None, timeout_signal='TERM'):
504507
global _last_log_had_output
505508

@@ -516,7 +519,7 @@ def __run_command(command, use_test_user, a_input, a_stdout, a_stderr, log_outpu
516519
command = ['runuser', options.username, '-c', ' '.join(map(shell_quote, command))]
517520

518521
# Figure out stdin
519-
stdin = None
522+
stdin = _devnull
520523
if a_input is not None:
521524
stdin = subprocess.PIPE
522525

0 commit comments

Comments
 (0)