Cleanup watchers properly

This commit is contained in:
Oliver Davies 2025-08-05 18:31:43 +01:00
parent b4cf963495
commit 88dbfbd825
2 changed files with 36 additions and 5 deletions

View file

@ -30,8 +30,22 @@
];
text = ''
simple-http-server --index --nocache "$@" & \
tailwindcss --output tailwind.css --watch & \
set -o monitor
simple-http-server --index --nocache "$@" &
PID_SERVER=$!
tailwindcss --output tailwind.css --watch &
PID_TAILWIND=$!
cleanup() {
echo "Stopping processes..."
kill "$PID_SERVER" "$PID_TAILWIND" 2>/dev/null || true
wait "$PID_SERVER" "$PID_TAILWIND" 2>/dev/null || true
}
trap cleanup EXIT
wait
'';
})