diff options
author | P. J. McDermott <pj@pehjota.net> | 2018-06-01 22:56:37 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2018-06-04 01:34:26 (EDT) |
commit | 1b208ec3f5f303ed93d958b3d8f6d5732cf1a245 (patch) | |
tree | 19db9ae421d74ccfd07237019baf0c9c578996bf | |
parent | 5feae401e3b03cefa1193b2b73fe919990aca016 (diff) | |
download | homerc-1b208ec3f5f303ed93d958b3d8f6d5732cf1a245.zip homerc-1b208ec3f5f303ed93d958b3d8f6d5732cf1a245.tar.gz homerc-1b208ec3f5f303ed93d958b3d8f6d5732cf1a245.tar.bz2 |
bin/rc: Close and reopen RC FIFO to make read block
Otherwise, after every command is read and handled, the read utility
immediately returns failure due to EOF on every call until another
command is written to the RC FIFO, causing the listening loop to become
busy and burn CPU time.
-rwxr-xr-x | bin/rc | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -145,7 +145,7 @@ listen() local arg= while :; do - if read -r magic cmd arg; then + if read -r magic cmd arg 0<"${rc_fifo}"; then case "${magic}" in "${MAGIC}");; *) continue;; esac case "${cmd}" in 'beg' | 'end') @@ -168,7 +168,7 @@ listen() ;; esac fi - done 0<"${rc_fifo}" + done return 0 } |