Skip to content

Commit c5bf320

Browse files
committed
Stop the watcher when the connector output it watches can't be read
The output file was checked once, before polling. If it went away later, wc failed, the line count read as zero, and the watcher slept forever while looking alive. Each poll now checks the file and exits 2 if it can't be read.
1 parent cd6ca16 commit c5bf320

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎skills/basecamp-connect/watch-requests.sh‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ fi
2525

2626
unhandled() {
2727
local lines
28+
if [ ! -r "$out" ]; then
29+
echo "watch-requests: can't read the connector output at $out" >&2
30+
exit 2
31+
fi
2832
lines=$(($(wc -l < "$out")))
2933
[ "$lines" -gt 0 ] || return 1
3034
head -n "$lines" "$out" | HANDLED=$handled awk '

0 commit comments

Comments
 (0)