jsonrpyc icon indicating copy to clipboard operation
jsonrpyc copied to clipboard

avoid sucking down a cpu when input pipe closes

Open dickmao opened this issue 9 months ago • 0 comments

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.

dickmao avatar May 23 '24 21:05 dickmao