Missing output when running mdx
Closed this issue · 1 comments
talex5 commented
In https://github.com/ocaml-multicore/eioio/blob/main/README.md#getting-started I use MDX with this example:
# #require "eunix";;
# let main stdenv =
let src = Eio.Source.of_string "Hello, world!\n" in
let dst = Eio.Stdenv.stdout stdenv in
Eio.Sink.write dst ~src;;
val main : < stdout : Eio.Sink.t; .. > -> unit = <fun>
# Eunix.run main;;
- : unit = ()
# (* prints "Hello, world!" *)
However, it doesn't capture the output (I had to add it as a comment instead).
Interestingly, if I change the last command to
# print_endline "Wibble!"; Eunix.run main;;
then it shows the output as Hello, w
, suggesting that it has tried to read the number of bytes that the print statement produced. Any idea what might cause that?
talex5 commented
I guess it's because it redirects output to a file rather than a pipe, and ocaml-uring wrote to the file at offset zero (rather than using the current position). Fixed by ocaml-multicore/ocaml-uring#17.