Skip to content

Commit f8fafc3

Browse files
Fix skip spec execution on error exit (#13986)
1 parent cb727c1 commit f8fafc3

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

src/spec/dsl.cr

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -205,18 +205,23 @@ module Spec
205205
def self.run
206206
@@start_time = Time.monotonic
207207

208-
at_exit do
209-
log_setup
210-
maybe_randomize
211-
run_filters
212-
root_context.run
213-
rescue ex
214-
STDERR.print "Unhandled exception: "
215-
ex.inspect_with_backtrace(STDERR)
216-
STDERR.flush
217-
@@aborted = true
218-
ensure
219-
finish_run
208+
at_exit do |status|
209+
# Do not run specs if the process is exiting on an error
210+
next unless status == 0
211+
212+
begin
213+
log_setup
214+
maybe_randomize
215+
run_filters
216+
root_context.run
217+
rescue ex
218+
STDERR.print "Unhandled exception: "
219+
ex.inspect_with_backtrace(STDERR)
220+
STDERR.flush
221+
@@aborted = true
222+
ensure
223+
finish_run
224+
end
220225
end
221226
end
222227

0 commit comments

Comments
 (0)