jsonrpyc
jsonrpyc copied to clipboard
avoid sucking down a cpu when input pipe closes
python - <<EOF
from time import sleep
import jsonrpyc; from subprocess import Popen, PIPE
p=Popen(["sleep", "120"], stdin=PIPE, stdout=PIPE)
rpc = jsonrpyc.RPC(stdin=p.stdout)
p.kill()
while rpc.watchdog.is_alive():
sleep(1)
EOF
Now look at the processes on your machine. At least on my Linux system, I see the python suck down a core.