diff --git a/runtime/index.js b/runtime/index.js index 25e36ac9..322aa580 100644 --- a/runtime/index.js +++ b/runtime/index.js @@ -163,7 +163,14 @@ entrypoint: { } } - if (runAfterCompile) execFileSync(Prefs.o, [], { stdio: 'inherit' }); + if (runAfterCompile) { + try { + execFileSync(Prefs.o, [], { stdio: 'inherit' }); + } catch (e) { + if (e?.status == null && e?.signal == null) throw e; + runStatus = e.status ?? 1; + } + } } finally { if (tmpRunDir) fs.rmSync(tmpRunDir, { recursive: true, force: true }); } diff --git a/runtime/repl.js b/runtime/repl.js index 05a24998..ba7d895f 100644 --- a/runtime/repl.js +++ b/runtime/repl.js @@ -83,7 +83,7 @@ const run = (source, _context, _filename, callback) => { } catch (e) { const visible = visibleOutput(); if (visible) process.stdout.write(visible); - console.log('Uncaught', e.stack ? e.stack : e); + if (e?.status == null) console.log('Uncaught', e.stack ? e.stack : e); } callback();