Current section
Files
Jump to
Current section
Files
priv/.fwatch.sh
#!/usr/bin/env bash
# NOTE: This script is generated by fwatch.
# You can simply ignore this file,
# because this script generate everytime you start fwatch.
# Contents are identical to the following URL.
# https://hexdocs.pm/elixir/Port.html#module-zombie-operating-system-processes
# Start the program in the background
exec "$@" &
pid1=$!
# Silence warnings from here on
exec >/dev/null 2>&1
# Read from stdin in the background and
# kill running program when stdin closes
exec 0<&0 "$(
while read -r; do :; done
kill -KILL $pid1
)" &
pid2=$!
# Clean up
wait $pid1
ret=$?
kill -KILL $pid2
exit $ret