Skip to content

Commit ce379b4

Browse files
committed
[test] Replace check_output with low level version
1 parent 232e3e8 commit ce379b4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

test/functional/test_framework/test_node.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,5 +181,10 @@ def send_cli(self, command, *args, **kwargs):
181181
if named_args:
182182
p_args += ["-named"]
183183
p_args += [command] + pos_args + named_args
184-
cli_output = subprocess.check_output(p_args, input=self.input, universal_newlines=True)
185-
return json.loads(cli_output, parse_float=decimal.Decimal)
184+
process = subprocess.Popen(p_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
185+
cli_stdout, cli_stderr = process.communicate(input=self.input)
186+
returncode = process.poll()
187+
if returncode:
188+
# Ignore cli_stdout, raise with cli_stderr
189+
raise subprocess.CalledProcessError(returncode, self.binary, output=cli_stderr)
190+
return json.loads(cli_stdout, parse_float=decimal.Decimal)

0 commit comments

Comments
 (0)