Skip to content

Instantly share code, notes, and snippets.

@mbernat
Last active December 23, 2019 00:14
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbernat/abf651653c123374037c27377f41d0a0 to your computer and use it in GitHub Desktop.
Save mbernat/abf651653c123374037c27377f41d0a0 to your computer and use it in GitHub Desktop.
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