diff --git a/lib/rerun/runner.rb b/lib/rerun/runner.rb index 22000af..71999b5 100644 --- a/lib/rerun/runner.rb +++ b/lib/rerun/runner.rb @@ -129,10 +129,6 @@ def force_polling end def start - if windows? - raise "Sorry, Rerun does not work on Windows." - end - if @already_running taglines = [ "Here we go again!", @@ -153,14 +149,13 @@ def start clear_screen if clear? start_keypress_thread unless @keypress_thread - @pid = Kernel.fork do - begin - exec(@run_command) - rescue => e - puts "#{e.class}: #{e.message}" - exit - end + begin + @pid = run @run_command + rescue => e + puts "#{e.class}: #{e.message}" + exit end + status_thread = Process.detach(@pid) # so if the child exits, it dies Signal.trap("INT") do # INT = control-C -- allows user to stop the top-level rerun process @@ -209,6 +204,10 @@ def start end end + def run command + Kernel.spawn command + end + def change_message(changes) message = [:modified, :added, :removed].map do |change| count = changes[change] ? changes[change].size : 0