dotfiles/bin/watch-changes
Oliver Davies 5763900b5f fix(scripts): vendor files causing reloads
Ignore the `vendor` directory and some others as it was causing the
script to reload when it wasn't expected.

Whilst I'd expect it to be ignored if I specified the path to look at as
something like `web/modules/custom`, but it still seems to trigger the
command and it seems a lot more stable since adding this.
2023-10-03 18:14:37 +01:00

18 lines
289 B
Bash
Executable file

#!/usr/bin/env bash
if [[ "$1" == "" || "$2" == "" ]]; then
echo "usage: ${0##*/} <file> <command>";
exit 2;
fi
set -uo pipefail
while true; do
inotifywait \
--event modify \
--event move_self \
--exclude ".git|simpletest|vendor" \
--recursive \
$1 && $2
done