@@ -66,6 +66,10 @@ define abstract class <basic-main-command> (<basic-command>)
66
66
init-keyword: dfm?:;
67
67
constant slot %dispatch-coloring :: false-or (<symbol> ) = #f ,
68
68
init-keyword: dispatch-coloring:;
69
+ // When #t serious warnings DO NOT cause an error exit status to be returned
70
+ // to the shell.
71
+ constant slot %allow-serious-warnings? :: <boolean> = #f ,
72
+ init-keyword: allow-serious-warnings?:;
69
73
/*---*** fill this in later.
70
74
constant slot %exports? :: <boolean> = #f,
71
75
init-keyword: exports?:;
@@ -77,9 +81,9 @@ end class <basic-main-command>;
77
81
78
82
define method execute-main-command
79
83
(context :: <server-context>, command :: <basic-main-command>)
80
- => (status -code :: <integer> )
81
- local method run
82
- ( class :: subclass(<command>), #rest arguments) => ()
84
+ => (exit -code :: <integer> )
85
+ local method run ( class :: subclass(<command>), #rest arguments)
86
+ => (#rest values )
83
87
let command = apply (make , class , server: context, arguments);
84
88
execute-command(command)
85
89
end method run;
@@ -96,21 +100,27 @@ define method execute-main-command
96
100
run(<open-project-command>, file: filename)
97
101
end ;
98
102
let build? = command.%build?;
103
+ let exit-code = #f ;
99
104
if (build? | command.%compile?)
100
- run(<build-project-command>,
101
- clean?: command.%clean?,
102
- link?: #f ,
103
- release?: command.%release?,
104
- verbose?: command.%verbose?,
105
- subprojects: command.%subprojects?,
106
- output: begin
107
- let output = make (<stretchy-object-vector>);
108
- if (command.%assemble?) add! (output, # "assembler" ) end ;
109
- if (command.%dfm?) add! (output, # "dfm" ) end ;
110
- if (command.%harp?) add! (output, # "harp" ) end ;
111
- output
112
- end ,
113
- dispatch-coloring: command.%dispatch-coloring)
105
+ // By default the build command returns an error status for serious
106
+ // warnings. This makes it possible for scripting to abort on serious
107
+ // warnings.
108
+ exit-code
109
+ := run(<build-project-command>,
110
+ clean?: command.%clean?,
111
+ link?: #f ,
112
+ release?: command.%release?,
113
+ verbose?: command.%verbose?,
114
+ subprojects: command.%subprojects?,
115
+ output: begin
116
+ let output = make (<stretchy-object-vector>);
117
+ if (command.%assemble?) add! (output, # "assembler" ) end ;
118
+ if (command.%dfm?) add! (output, # "dfm" ) end ;
119
+ if (command.%harp?) add! (output, # "harp" ) end ;
120
+ output
121
+ end ,
122
+ dispatch-coloring: command.%dispatch-coloring,
123
+ allow-serious-warnings?: command.%allow-serious-warnings?);
114
124
end ;
115
125
if (build? | command.%link?)
116
126
let target = command.%target;
@@ -123,7 +133,7 @@ define method execute-main-command
123
133
subprojects: command.%subprojects?,
124
134
unify?: command.%unify?)
125
135
end ;
126
- $success-exit-code;
136
+ exit-code | $success-exit-code
127
137
end method execute-main-command;
128
138
129
139
define method execute-main-loop
@@ -150,8 +160,9 @@ define method do-execute-command
150
160
next-handler()
151
161
else
152
162
display-condition(context, condition);
153
- message(context, "Exiting with return code %d" , $error-exit-code);
154
- return($error-exit-code)
163
+ message(context, "Exiting with return code %d" ,
164
+ $unexpected-error-exit-code);
165
+ return($unexpected-error-exit-code)
155
166
end
156
167
end ;
157
168
local method run
0 commit comments