You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 1509 Reporter: administrator Status: closed Resolution: fixed Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Thomas Ball
Version: Ocaml 3.06
OS: Windows XP
Submission from: 131.107.3.79 (131.107.3.79)
(* I am trying to redirect stdout to a file under native Windows )
( but am running into the following problem: the Windows version of )
( dup2 seems to be incorrect, as the following code shows*)
let main () = begin
let ochan = open_out "test" in
let fd_stdout = Unix.descr_of_out_channel stdout in
let dup_stdout = Unix.dup fd_stdout in
Printf.fprintf stderr "1\n"; flush stderr;
let fd_ochan = Unix.descr_of_out_channel ochan in
Printf.fprintf stderr "2\n"; flush stderr;
Unix.dup2 fd_ochan fd_stdout;
Printf.fprintf stderr "3\n"; flush stderr;
(* following line yields 'Fatal error: exception Sys_error("Bad file
descriptor")' *)
Printf.fprintf stdout "Hello world!";
end ;;
main();;
The text was updated successfully, but these errors were encountered:
(* I am trying to redirect stdout to a file under native Windows )
( but am running into the following problem: the Windows version of )
( dup2 seems to be incorrect, as the following code shows*)
You're correct, the effect of Unix.dup2 was not properly reflected on
the C standard I/O channels underlying OCaml's channels. I have fixed
this in the working sources. Let me know if you need a patch against
OCaml 3.06.
Thanks, Xavier. We've got a work-around for now, so I'll wait for the next release.
-- Tom
-----Original Message-----
From: Xavier Leroy [mailto:xavier.leroy@inria.fr]
Sent: Mon 1/6/2003 7:27 AM
To: Tom Ball
Cc: Caml bug tracking system
Subject: Re: dup2 not working under native Windows (#7982)
Dear Thomas,
> (* I am trying to redirect stdout to a file under native Windows *)
> (* but am running into the following problem: the Windows version of *)
> (* dup2 seems to be incorrect, as the following code shows*)
You're correct, the effect of Unix.dup2 was not properly reflected on
the C standard I/O channels underlying OCaml's channels. I have fixed
this in the working sources. Let me know if you need a patch against
OCaml 3.06.
Cheers,
- Xavier
Original bug ID: 1509
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Thomas Ball
Version: Ocaml 3.06
OS: Windows XP
Submission from: 131.107.3.79 (131.107.3.79)
(* I am trying to redirect stdout to a file under native Windows )
( but am running into the following problem: the Windows version of )
( dup2 seems to be incorrect, as the following code shows*)
let main () = begin
let ochan = open_out "test" in
let fd_stdout = Unix.descr_of_out_channel stdout in
let dup_stdout = Unix.dup fd_stdout in
Printf.fprintf stderr "1\n"; flush stderr;
let fd_ochan = Unix.descr_of_out_channel ochan in
Printf.fprintf stderr "2\n"; flush stderr;
Unix.dup2 fd_ochan fd_stdout;
Printf.fprintf stderr "3\n"; flush stderr;
(* following line yields 'Fatal error: exception Sys_error("Bad file
descriptor")' *)
Printf.fprintf stdout "Hello world!";
end ;;
main();;
The text was updated successfully, but these errors were encountered: