Skip to content

Commit

Permalink
On mac, calling fsync on stdout/stderr when not isatty returns ENOTSUP
Browse files Browse the repository at this point in the history
  • Loading branch information
hoodmane committed Feb 17, 2025
1 parent 0abd74f commit ed8409f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/js/streams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ function nodeFsync(fd: number): void {
try {
fs.fsyncSync(fd);
} catch (e: any) {
if (e && e.code === "EINVAL") {
if (e?.code === "EINVAL") {
return;
}
// On mac, calling fsync on stdout/stderr when not isatty returns ENOTSUP
if (e?.code === "ENOTSUP" && (fd === 1 || fd === 2)) {
return;
}
throw e;
Expand Down

0 comments on commit ed8409f

Please sign in to comment.