mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
tests: Encode input data for the subprocess
Needed for Python2/3 compatibility.
This commit is contained in:
parent
928befeea2
commit
b8b06e6680
1 changed files with 2 additions and 2 deletions
|
@ -124,7 +124,7 @@ def _queue_output(arguments, pidq, outputq):
|
||||||
This function is meant to be executed in a thread as it may block
|
This function is meant to be executed in a thread as it may block
|
||||||
"""
|
"""
|
||||||
kwargs = arguments["process"]
|
kwargs = arguments["process"]
|
||||||
input = arguments["input"]
|
input_data = arguments["input"].encode("utf-8") if arguments["input"] else None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
proc = Popen(**kwargs)
|
proc = Popen(**kwargs)
|
||||||
|
@ -146,7 +146,7 @@ def _queue_output(arguments, pidq, outputq):
|
||||||
pidq.put(proc.pid)
|
pidq.put(proc.pid)
|
||||||
|
|
||||||
# Send input and wait for finish
|
# Send input and wait for finish
|
||||||
out, err = proc.communicate(input)
|
out, err = proc.communicate(input_data)
|
||||||
|
|
||||||
if sys.version_info > (3,):
|
if sys.version_info > (3,):
|
||||||
out, err = out.decode('utf-8'), err.decode('utf-8')
|
out, err = out.decode('utf-8'), err.decode('utf-8')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue