beginner question about exit/breaking out of fswatch
molleweide opened this issue · 1 comments
molleweide commented
Hi there,
why doesn't this exit the command
launch_do() {
local TITLE="wm_custom_launcher"
open -n -a "/Applications/Alacritty.app" \
--args -t "${TITLE}" \
-e "launcher-filter" "${TITLE}" # -e launch_filter
local ect=0
fswatch -0 /tmp/$TITLE | while read -d "" event
do \
ect=$(( $ect + 1 ))
echo "e$ect: ${event}"
if test "$ect" = "2"; then
# it turns out my value is always written on second event.
local rt=$(cat "/tmp/${TITLE}")
echo "rt: $rt"
# break
exit
fi
done
echo "outside..."
}
I spawn a new terminal instance and writes it's results to a tmp file. rt
echoes correctly but it doesn't break or exit?
What am I doing wrong?
molleweide commented
oh never mind. I just found this thread solving my problem.
https://unix.stackexchange.com/questions/336894/kill-the-parent-of-a-child-pipe-process