Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

## Bug fixes
* Runtime: fix path normalization (#1848)
* Runtime: fix initialization of standard streams under Windows (#1849)

# 6.0.1 (2025-02-07) - Lille

Expand Down
9 changes: 9 additions & 0 deletions compiler/tests-jsoo/gh1845.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

$ echo 'prerr_endline "test"' > test.ml

$ ocamlc test.ml -o test.bc

$ dune exec -- js_of_ocaml test.bc -o test.js

$ node test.js
test
12 changes: 9 additions & 3 deletions runtime/js/fs_node.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,9 +392,15 @@ class MlNodeFd extends MlFile {
this.fs = require("node:fs");
this.fd = fd;
this.flags = flags;
var stats = this.fs.fstatSync(fd);
flags.noSeek =
stats.isCharacterDevice() || stats.isFIFO() || stats.isSocket();
try {
var stats = this.fs.fstatSync(fd);
flags.noSeek =
stats.isCharacterDevice() || stats.isFIFO() || stats.isSocket();
} catch (err) {
// The fstat will fail on standard streams under Windows with node
// 18 (and lower). See https://github.com/libuv/libuv/pull/3811.
flags.noSeek = true;
}
this.offset = this.flags.append ? stats.size : 0;
this.seeked = false;
}
Expand Down
Loading