Closed phuang1024 closed 3 years ago
Use subprocess.Popen.stdin/stdout instead of opening files:
subprocess.Popen.stdin/stdout
# OLD: with open(IN, "r") as stdin, open(OUT, "w") as stdout: subprocess.Popen([path], stdin=stdin, stdout=stdout).wait()
# NEW: p = subprocess.Popen([path], stdin=subprocess.PIPE, stdout=subprocess.PIPE) p.stdin.write(b"isready\n") p.stdin.flush() p.stdout.read()
Changed and tested all three files in tests/.
tests/
Describe changes
Use
subprocess.Popen.stdin/stdout
instead of opening files:Additional info
Changed and tested all three files in
tests/
.