Last active
December 23, 2019 00:14
-
-
Save mbernat/abf651653c123374037c27377f41d0a0 to your computer and use it in GitHub Desktop.
Automatically restart an esy binary after a rebuild
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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