Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unix.close_process_out hangs #2715

Closed
vicuna opened this issue Jun 14, 2004 · 1 comment
Closed

Unix.close_process_out hangs #2715

vicuna opened this issue Jun 14, 2004 · 1 comment
Labels

Comments

@vicuna
Copy link

vicuna commented Jun 14, 2004

Original bug ID: 2715
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Florian Hars
Version: 3.07+2
OS: Linux 2.6.6 / OpenBSD 3.5
Submission from: grisu.bik-gmbh.de (217.110.154.194)

If I compile (no difference between ocamlc and ocamlopt) and run the following
program, the file pre looks like expected, foo.txt, foo2.txt and pre2 are all
empty, and the call to Unix.close_process_out oc never returns. Adding flushes
to taste doesn't really change anything.
If I close oc2 before oc, everything works. This is at least counterintuitive.

let _ =
let oc = Unix.open_process_out "tee pre | sort -u > foo.txt"
and oc2 = Unix.open_process_out "tee pre2 | sort -u > foo2.txt"
in
prerr_endline "Before";
for i = 1 to 10 do
for j = 0 to 9 do
Printf.fprintf oc "Foo %d\n" j;
Printf.fprintf oc2 "Foo %d\n" j;
done
done;
prerr_endline "After";
ignore(Unix.close_process_out oc);
prerr_endline "Never reached";
ignore(Unix.close_process_out oc2);
prerr_endline "Never ever reached"

@vicuna
Copy link
Author

vicuna commented Jun 19, 2004

Comment author: administrator

Fixed 2004-06-19 by XL

@vicuna vicuna closed this as completed Jun 19, 2004
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant