Skip to content

Commit 22bc769

Browse files
committed
fix(napi/oxlint): use process.exitCode
1 parent 2081992 commit 22bc769

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

napi/oxlint2/src/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,11 @@ async function main() {
100100
const linter = new Linter();
101101

102102
const success = await linter.run();
103-
if (!success) {
104-
process.exit(1);
105-
}
103+
104+
// Note: It's recommended to set `process.exitCode` instead of calling `process.exit()`.
105+
// `process.exit()` kills the process immediately and `stdout` may not be flushed before process dies.
106+
// https://nodejs.org/api/process.html#processexitcode
107+
if (!success) process.exitCode = 1;
106108
}
107109

108110
main();

0 commit comments

Comments
 (0)