Automatically restart an esy binary after a rebuild

December 13, 2019 · View on GitHub

#!/usr/bin/env bash

APP=$1 PID="nope" inotifywait -q -m -e create _esy/default | while read -r filename event; do if [[ "event"=="CREATEbuild"]];thenif[["event" == "CREATE build" ]]; then if [[ "(ps -ao '%p' | grep PID)"!=""]];thenkill9{PID})" != "" ]]; then kill -9 {PID} fi _esy/default/build/default/bin/APP/{APP}/{APP}.exe & PID=$! fi done