From 399ab1f617e8efa966498188b750781cf4bbb621 Mon Sep 17 00:00:00 2001 From: "Congcong Cai (EE-CN-42)" Date: Wed, 8 Jun 2022 12:29:09 +0800 Subject: [PATCH] fix: 'asc' will not exit with exit code 1 after compile failing(#2311) --- bin/asc.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/asc.js b/bin/asc.js index a5b6e1227b..8924e92340 100644 --- a/bin/asc.js +++ b/bin/asc.js @@ -19,15 +19,17 @@ if ((!hasSourceMaps || ~posCustomArgs) && !isDeno) { nodeArgs.push(...args.slice(posCustomArgs + 1)); args.length = posCustomArgs; } - (await import("child_process")).spawnSync( + const { status, signal } = (await import("child_process")).spawnSync( nodePath, [...nodeArgs, thisPath, ...args], { stdio: "inherit" } ); + if (status || signal) process.exitCode = 1; } else { - const { error } = (await import("../dist/asc.js")).main(process.argv.slice(2), { + const apiResult = (await import("../dist/asc.js")).main(process.argv.slice(2), { stdout: process.stdout, stderr: process.stderr }); + const { error } = await apiResult; if (error) process.exitCode = 1; }