Skip to content

Commit 5aed282

Browse files
authored
exit with non-0 code on boot-file errors (#975)
When an error is encountered within a boot file --- either raised explicitly by the boot file's code or due to certain kinds of problems with a boot file's content --- then exit with a non-0 code (meaning failure) instead of a 0 exit code.
1 parent 1dec8a6 commit 5aed282

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

mats/7.ms

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1068,12 +1068,17 @@
10681068
(lambda ()
10691069
(pretty-print '(display "hello 5\n")))
10701070
'(replace))
1071+
(with-output-to-file "testfile-6.ss"
1072+
(lambda ()
1073+
(pretty-print '(error 'boot "fail")))
1074+
'(replace))
10711075
(parameterize ([optimize-level 2])
10721076
(compile-script "testfile-1")
10731077
(compile-script "testfile-2")
10741078
(compile-file "testfile-3")
10751079
(compile-file "testfile-4")
1076-
(compile-file "testfile-5")))
1080+
(compile-file "testfile-5")
1081+
(compile-file "testfile-6")))
10771082
(void))
10781083
(equal?
10791084
(begin
@@ -1180,6 +1185,14 @@
11801185
(unless (eof-object? err) (error 'bootfile-test2 err))
11811186
out)))
11821187
"#<code>\n"))
1188+
;; make sure an error from a boot file exits with a non-0 exit code
1189+
(not (equal?
1190+
(begin
1191+
(parameterize ([optimize-level 2])
1192+
(make-boot-file "testfile.boot" '("petite")
1193+
"testfile-6.so"))
1194+
(system (format "~a -b ./testfile.boot -q" (patch-exec-path *scheme*))))
1195+
0))
11831196
)
11841197
11851198
(mat hostop

release_notes/release_notes.stex

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2868,6 +2868,13 @@ in fasl files does not generally make sense.
28682868
%-----------------------------------------------------------------------------
28692869
\section{Bug Fixes}\label{section:bugfixes}
28702870

2871+
\subsection{Exit with failure on error from boot file (10.3.0)}
2872+
2873+
When an error is encountered within a boot file---either raised
2874+
explicitly by the boot file's code or due to certain kinds of problems
2875+
with a boot file's content---then exit with a non-0 code (meaning
2876+
failure) instead of a 0 exit code.
2877+
28712878
\subsection{Respect constraint on \scheme{make-record-constructor-descriptor} (10.2.0)}
28722879

28732880
The source optimizer (cp0) overlooked the constraint that, when forming a

s/7.ss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@
664664

665665
(set! reset-handler
666666
($make-thread-parameter
667-
(lambda () (c-exit 0))
667+
(lambda () (c-exit -1)) ; error during load of boot file uses this handler
668668
(lambda (v)
669669
(unless (procedure? v)
670670
($oops 'reset-handler "~s is not a procedure" v))

0 commit comments

Comments
 (0)