File tree Expand file tree Collapse file tree 3 files changed +18
-12
lines changed
Expand file tree Collapse file tree 3 files changed +18
-12
lines changed Original file line number Diff line number Diff line change 44. " ${BASH_SOURCE%/* } /setup"
55
66" ${BUILD_CMD[@]} " || true
7- " ${WATCH_CMD[@]} " | xargs -n1 -I{} " ${BUILD_CMD[@ ]} "
7+ watch " ${BUILD_CMD[* ]} "
Original file line number Diff line number Diff line change 146146
147147# Watch ------------------------------------------------------------------------
148148
149- export WATCH_CMD=(watch --one-per-batch --recursive)
149+ watch () {
150+ local COMMAND=" $1 "
150151
151- if [[ " $OSTYPE " =~ ^(linux-gnu| msys| cygwin)$ ]]; then
152- # The default monitor notifies on read accesses...
153- WATCH_CMD+=(--monitor poll_monitor ' --latency=5' )
154- fi
152+ if command -v fswatch > /dev/null; then
153+ local WATCH_CMD=(fswatch --one-per-batch --recursive)
155154
156- WATCH_CMD+=(../* )
155+ if [[ " $OSTYPE " =~ ^(linux-gnu| msys| cygwin)$ ]]; then
156+ # The default monitor notifies on read accesses...
157+ WATCH_CMD+=(--monitor poll_monitor ' --latency=5' )
158+ fi
157159
158- watch () {
159- if ! command -v fswatch > /dev/null; then
160- >&2 echo " WARNING: Could not find fswatch ( http://emcrisostomo.github.io/fswatch/ )."
160+ WATCH_CMD+=(../* )
161+
162+ " ${WATCH_CMD[@]} " | xargs -n1 -I{} sh -c " $COMMAND "
163+ elif command -v watchexec > /dev/null; then
164+ watchexec --watch .. --postpone -- " sh -c '$COMMAND '"
165+ else
166+ >&2 echo " WARNING: Could not find fswatch ( http://emcrisostomo.github.io/fswatch/ ) or watchexec ( https://github.com/watchexec/watchexec )."
167+ exit 1
161168 fi
162- fswatch " $@ "
163169}
Original file line number Diff line number Diff line change 55
66" ${BUILD_CMD[@]} " || true
77" ${TEST_CMD[@]} " || true
8- " ${WATCH_CMD[@]} " | xargs -n1 -I{} sh -c " ${BUILD_CMD[*]} && ${TEST_CMD[*]} "
8+ watch " ${BUILD_CMD[*]} && ${TEST_CMD[*]} "
You can’t perform that action at this time.
0 commit comments