build: separate runtime artifacts and supervise command ownership

This commit is contained in:
morluto
2026-10-09 20:11:17 +08:00
parent c8544b1574
commit abc4f47683
32 changed files with 795 additions and 786 deletions
+3 -6
View File
@@ -44,7 +44,6 @@ if (!(await compiledRuntimeExists(runtimeFiles))) {
const {
renderCliOutputArgumentError,
renderEmptyFilteredCliOutput,
sanitizeCliOutput,
validateCliOutputArguments,
} = await import("../dist/cliOutput.js");
const outputArguments = validateCliOutputArguments(args);
@@ -57,13 +56,11 @@ if (!(await compiledRuntimeExists(runtimeFiles))) {
await createCli(process.env, resultOutput).serve(args, {
stdout: (output) => {
if (resultOutput?.handled) {
if (resultOutput.failed)
process.stderr.write(sanitizeCliOutput(output));
if (resultOutput.failed) process.stderr.write(output);
return;
}
const sanitized = sanitizeCliOutput(output);
if (sanitized.length > 0) wroteOutput = true;
process.stdout.write(sanitized);
if (output.length > 0) wroteOutput = true;
process.stdout.write(output);
},
});
if (!wroteOutput && !resultOutput?.handled)