Skip to content

Instantly share code, notes, and snippets.

@eiro
Created October 28, 2011 12:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eiro/1322199 to your computer and use it in GitHub Desktop.
Save eiro/1322199 to your computer and use it in GitHub Desktop.
inotify based autoreload for perl dancer
#! /usr/bin/env zsh
dancer_pid=
dancer () {
perl bin/dancer &
dancer_pid=$!
}
kill_dancer () { kill $dancer_pid }
restart_dancer () { kill_dancer && dancer }
changes_in_source_tree () {inotifywait -r -e modify --exclude ".*swp" . }
dancer
trap kill_dancer 2 3
while {changes_in_source_tree} {restart_dancer}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment