diff --git a/sos/utilities.py b/sos/utilities.py index a69536b309..ebb3c654d3 100644 --- a/sos/utilities.py +++ b/sos/utilities.py @@ -282,10 +282,17 @@ def _check_poller(proc): expanded_args.append(arg) if to_file: _output = open(to_file, 'w') + prep_p = Popen(expanded_args, shell=False, stdout=PIPE, + stderr=STDOUT if stderr else PIPE, + bufsize=-1, env=cmd_env, close_fds=True, + preexec_fn=_child_prep_fn) + _stdin = prep_p.stdout + expanded_args = ['cat'] else: _output = PIPE + _stdin = None try: - p = Popen(expanded_args, shell=False, stdout=_output, + p = Popen(expanded_args, stdin=_stdin, shell=False, stdout=_output, stderr=STDOUT if stderr else PIPE, bufsize=-1, env=cmd_env, close_fds=True, preexec_fn=_child_prep_fn)