#!/usr/bin/env bash set -euo pipefail # Killing watchexec ourselves, it may not be done otherwise. function finish { if [ -n "${LIVE_SERVER_PID:-}" ]; then kill "$LIVE_SERVER_PID" > /dev/null 2>&1 fi } trap finish EXIT watchexec \ --watch src \ --clear clear \ --restart \ zig build run & LIVE_SERVER_PID="$!" while true; do sleep 1; done