clean up children at exit -- had about twenty processes all watching and recompiling the docs

This commit is contained in:
Jeremy Ashkenas
2009-12-21 12:15:13 -05:00
parent c7fa9c320a
commit 9bb3e3fbe8
2 changed files with 4 additions and 1 deletions

View File

@@ -18,7 +18,9 @@ end
desc "Build the documentation page" desc "Build the documentation page"
task :doc do task :doc do
source = 'documentation/index.html.erb' source = 'documentation/index.html.erb'
Thread.new { `bin/coffee-script documentation/cs/*.cs -o documentation/js -w` } child = fork { exec "bin/coffee-script documentation/cs/*.cs -o documentation/js -w" }
at_exit { Process.kill("INT", child) }
Signal.trap("INT") { exit }
loop do loop do
mtime = File.stat(source).mtime mtime = File.stat(source).mtime
if !@mtime || mtime > @mtime if !@mtime || mtime > @mtime

View File

@@ -65,6 +65,7 @@ Usage:
sleep WATCH_INTERVAL sleep WATCH_INTERVAL
end end
end end
Signal.trap("INT") { watch_thread.kill }
watch_thread.join watch_thread.join
end end