From 9b29f7ed062e2019c0fb125acec057e0a8f7cb88 Mon Sep 17 00:00:00 2001 From: Azalea Gui Date: Wed, 8 Mar 2023 09:46:50 -0500 Subject: [PATCH] [+] Script to restart when files change --- tngame-rs/.gitignore | 1 + tngame-rs/run_watch.sh | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 tngame-rs/.gitignore create mode 100755 tngame-rs/run_watch.sh diff --git a/tngame-rs/.gitignore b/tngame-rs/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/tngame-rs/.gitignore @@ -0,0 +1 @@ +/target diff --git a/tngame-rs/run_watch.sh b/tngame-rs/run_watch.sh new file mode 100755 index 0000000..5069c98 --- /dev/null +++ b/tngame-rs/run_watch.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +sigint_handler() +{ + kill $PID + exit +} + +trap sigint_handler SIGINT + +while true; do + cargo run & + PID=$! + inotifywait -e modify -e move -e create -e delete -e attrib -r `pwd` --include '.*\.rs' + kill $PID +done +