File tree Expand file tree Collapse file tree 3 files changed +10
-4
lines changed
Expand file tree Collapse file tree 3 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 1515
1616exit if options . nil? or options [ :cmd ] . nil? or options [ :cmd ] . empty?
1717
18- Rerun ::Runner . keep_running ( options [ :cmd ] , options )
18+ begin
19+ Rerun ::Runner . keep_running ( options [ :cmd ] , options )
20+ rescue Rerun ::ExitException
21+ exit 0
22+ end
Original file line number Diff line number Diff line change 1010require "rerun/glob"
1111
1212module Rerun
13-
13+ # Raised when the runner wants to exit cleanly.
14+ # This allows tests to catch the exit instead of terminating the process.
15+ class ExitException < StandardError ; end
1416end
1517
Original file line number Diff line number Diff line change @@ -160,7 +160,7 @@ def start
160160 say "Rerun (#{ $PID} ) running #{ app_name } (#{ @pid } )"
161161 rescue => e
162162 puts "#{ e . class } : #{ e . message } "
163- exit
163+ raise ExitException
164164 end
165165
166166 status_thread = Process . detach ( @pid ) # so if the child exits, it dies
@@ -235,7 +235,7 @@ def change_message(changes)
235235 def die
236236 #stop_keypress_thread # don't do this since we're probably *in* the keypress thread
237237 stop # stop the child process if it exists
238- exit 0 # todo: status code param
238+ raise ExitException # todo: status code param
239239 end
240240
241241 def join
You can’t perform that action at this time.
0 commit comments