Spinning up the hamster...

This commit is contained in:
coolnsx
2025-10-22 15:56:36 +05:30
parent 870fb04c8e
commit 5f5d065c18

View File

@@ -26,9 +26,9 @@ run_command() {
rm -f "$fifo_file" && mkfifo "$fifo_file" rm -f "$fifo_file" && mkfifo "$fifo_file"
printf "%s\n" "$2" >"$fifo_file" & printf "%s\n" "$2" >"$fifo_file" &
tail -f "$fifo_file" | websocat "ws://$url/$1" | while read line; do tail -f "$fifo_file" | websocat "ws://$url/$1" | while read line; do
printf "%b\n" "$line" | sed -nE 's|.*"data": "(.*)n"}|\1|p' printf "%b\n" "$line" | sed -nE 's|.*"data": "(.*)n"}|\1|p' &
# exit this loop if we receive exit from response # exit this loop if we receive exit from response
printf "%b\n" "$line" | grep -q '"exit"' && pkill -P $$ tail printf "%b\n" "$line" | grep -q '"exit"' && pkill -P $$ tail &
done done
rm -f "$fifo_file" rm -f "$fifo_file"
} }