Skip to content
Permalink
Browse files

tests: Encode input data for the subprocess

Needed for Python2/3 compatibility.
  • Loading branch information...
tbabej authored and pbeckingham committed Jan 2, 2019
1 parent 928befe commit b8b06e668064aa84617813a32401088f53deb01e
Showing with 2 additions and 2 deletions.
  1. +2 −2 test/basetest/utils.py
@@ -124,7 +124,7 @@ def _queue_output(arguments, pidq, outputq):
This function is meant to be executed in a thread as it may block
"""
kwargs = arguments["process"]
input = arguments["input"]
input_data = arguments["input"].encode("utf-8") if arguments["input"] else None

try:
proc = Popen(**kwargs)
@@ -146,7 +146,7 @@ def _queue_output(arguments, pidq, outputq):
pidq.put(proc.pid)

# Send input and wait for finish
out, err = proc.communicate(input)
out, err = proc.communicate(input_data)

if sys.version_info > (3,):
out, err = out.decode('utf-8'), err.decode('utf-8')

0 comments on commit b8b06e6

Please sign in to comment.
You can’t perform that action at this time.