Skip to content

Commit

Permalink
fix: use non-blocking io because rust does not support it now (#1252)
Browse files Browse the repository at this point in the history
  • Loading branch information
xusd320 authored Jun 6, 2024
1 parent 9b73ff5 commit cf8bb86
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions packages/mako/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,14 @@ export { BuildParams };
// ref:
// https://github.com/vercel/next.js/pull/51883
function blockStdout() {
if (process.platform === 'darwin') {
// rust needs stdout to be blocking, otherwise it will throw an error (on macOS at least) when writing a lot of data (logs) to it
// see https://github.com/napi-rs/napi-rs/issues/1630
// and https://github.com/nodejs/node/blob/main/doc/api/process.md#a-note-on-process-io
if ((process.stdout as any)._handle != null) {
(process.stdout as any)._handle.setBlocking(true);
}
if ((process.stderr as any)._handle != null) {
(process.stderr as any)._handle.setBlocking(true);
}
// rust needs stdout to be blocking, otherwise it will throw an error (on macOS at least) when writing a lot of data (logs) to it
// see https://github.com/napi-rs/napi-rs/issues/1630
// and https://github.com/nodejs/node/blob/main/doc/api/process.md#a-note-on-process-io
if ((process.stdout as any)._handle != null) {
(process.stdout as any)._handle.setBlocking(true);
}
if ((process.stderr as any)._handle != null) {
(process.stderr as any)._handle.setBlocking(true);
}
}

Expand Down

0 comments on commit cf8bb86

Please sign in to comment.