Skip to content

Commit fb0dfaf

Browse files
committed
Fix stderr
1 parent d414632 commit fb0dfaf

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/esbuild/wasiWorker.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,7 @@ async function runEsbuildWasi(
9999

100100
let exitCode: number;
101101
try {
102-
wasi.start(instance as any);
103-
exitCode = 0;
102+
exitCode = wasi.start(instance as any);
104103
} catch (e) {
105104
if (e instanceof WASIProcExit) {
106105
exitCode = e.code;
@@ -109,14 +108,14 @@ async function runEsbuildWasi(
109108
}
110109
}
111110

112-
if (exitCode !== 0) {
113-
return stderr;
114-
}
115-
116111
const wasiHeader = `// esbuild v${ESBUILD_VERSION} (GOOS=wasip1 GOARCH=wasm)`
117112
+ `\n// args: ${args.slice(1).filter((v) => !v.startsWith("--log")).join(" ")}`
118113
+ "\n\n";
119114

115+
if (exitCode !== 0) {
116+
return wasiHeader + stderr.trim();
117+
}
118+
120119
if (stdoutOutput) {
121120
return wasiHeader + stdout.trim();
122121
}

0 commit comments

Comments
 (0)