1 from __future__
import print_function
8 def kill_subprocess(process
):
13 # Pass -f=none and --output-style=GNU to get only one line of output per input.
14 cmd
= subprocess
.Popen(
15 [sys
.argv
[1], "--obj=" + sys
.argv
[2], "-f=none", "--output-style=GNU"],
16 stdout
=subprocess
.PIPE
,
17 stdin
=subprocess
.PIPE
,
19 watchdog
= threading
.Timer(20, kill_subprocess
, args
=[cmd
])
21 cmd
.stdin
.write(b
"0\n")
23 print(cmd
.stdout
.readline())
24 cmd
.stdin
.write(b
"bad\n")
26 print(cmd
.stdout
.readline())