@@ -234,6 +234,7 @@ class Job {
234234 this . logger . debug ( 'Compiling' ) ;
235235
236236 let compile ;
237+ let compile_errored = false ;
237238
238239 if ( this . runtime . compiled ) {
239240 compile = await this . safe_call (
@@ -242,16 +243,20 @@ class Job {
242243 this . timeouts . compile ,
243244 this . memory_limits . compile
244245 ) ;
246+ compile_errored = compile . code !== 0 ;
245247 }
246248
247- this . logger . debug ( 'Running' ) ;
249+ let run ;
250+ if ( ! compile_errored ) {
251+ this . logger . debug ( 'Running' ) ;
248252
249- const run = await this . safe_call (
250- this . runtime . run ,
251- [ code_files [ 0 ] . name , ...this . args ] ,
252- this . timeouts . run ,
253- this . memory_limits . run
254- ) ;
253+ run = await this . safe_call (
254+ this . runtime . run ,
255+ [ code_files [ 0 ] . name , ...this . args ] ,
256+ this . timeouts . run ,
257+ this . memory_limits . run
258+ ) ;
259+ }
255260
256261 this . state = job_states . EXECUTED ;
257262
@@ -277,6 +282,7 @@ class Job {
277282
278283 const code_files = this . files . filter ( file => file . encoding == 'utf8' ) ;
279284
285+ let compile_errored = false ;
280286 if ( this . runtime . compiled ) {
281287 eventBus . emit ( 'stage' , 'compile' ) ;
282288 const { error, code, signal } = await this . safe_call (
@@ -288,19 +294,22 @@ class Job {
288294 ) ;
289295
290296 eventBus . emit ( 'exit' , 'compile' , { error, code, signal } ) ;
297+ compile_errored = code !== 0 ;
291298 }
292299
293- this . logger . debug ( 'Running' ) ;
294- eventBus . emit ( 'stage' , 'run' ) ;
295- const { error, code, signal } = await this . safe_call (
296- this . runtime . run ,
297- [ code_files [ 0 ] . name , ...this . args ] ,
298- this . timeouts . run ,
299- this . memory_limits . run ,
300- eventBus
301- ) ;
300+ if ( ! compile_errored ) {
301+ this . logger . debug ( 'Running' ) ;
302+ eventBus . emit ( 'stage' , 'run' ) ;
303+ const { error, code, signal } = await this . safe_call (
304+ this . runtime . run ,
305+ [ code_files [ 0 ] . name , ...this . args ] ,
306+ this . timeouts . run ,
307+ this . memory_limits . run ,
308+ eventBus
309+ ) ;
302310
303- eventBus . emit ( 'exit' , 'run' , { error, code, signal } ) ;
311+ eventBus . emit ( 'exit' , 'run' , { error, code, signal } ) ;
312+ }
304313
305314 this . state = job_states . EXECUTED ;
306315 }
0 commit comments