Skip to content

Instantly share code, notes, and snippets.

@mbernat
Last active Dec 23, 2019
Embed
What would you like to do?
Automatically restart an esy binary after a rebuild
#!/usr/bin/env bash
APP=$1
PID="nope"
inotifywait -q -m -e create _esy/default |
while read -r filename event; do
if [[ "$event" == "CREATE build" ]]; then
if [[ "$(ps -ao '%p' | grep ${PID})" != "" ]]; then
kill -9 ${PID}
fi
_esy/default/build/default/bin/${APP}/${APP}.exe &
PID=$!
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment