aboutsummaryrefslogtreecommitdiffhomepage
path: root/ide/coq.ml
diff options
context:
space:
mode:
authorGravatar letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7>2011-04-21 16:16:12 +0000
committerGravatar letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7>2011-04-21 16:16:12 +0000
commiteb02dc13ff49491172268930bb4834cbbadceb9d (patch)
tree2cb61877df2c73591eec7d4be44788df639c4d75 /ide/coq.ml
parent12cf5007bbc2b8c6af5cd9cb2cb7fc882b40f623 (diff)
Coqide: better handling of stdout/stderr in win32
Now that coqide is a console-free win32 app, writing to nonexistent stdout/stderr lead to Sys_error. To avoid that: - We reroute coqide's stdout/stderr to either a pipe that will stay unread (by default), or to a temp log file (in debug mode). - When doing create_process, avoid referring to Unix.stderr: anything printed by coqtop to its stderr will be merged in the regular channel. - On the coqtop side, remove the awkward fix consisting in a \r printed on stderr apparently to fix coqide.byte. This fix is probably obsolete since the separation of coqide and coqtop as distinct processes. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@14047 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'ide/coq.ml')
-rw-r--r--ide/coq.ml19
1 files changed, 12 insertions, 7 deletions
diff --git a/ide/coq.ml b/ide/coq.ml
index 064447549..e0b08562b 100644
--- a/ide/coq.ml
+++ b/ide/coq.ml
@@ -135,17 +135,22 @@ let coqtop_zombies () =
doesn't call bin/sh, so args shouldn't be quoted. The process
cannot be terminated by a Unix.close_process, but rather by a
kill of the pid.
+
+ >--ide2top_w--[pipe]--ide2top_r-->
+ coqide coqtop
+ <--top2ide_r--[pipe]--top2ide_w--<
+
*)
let open_process_pid prog args =
- let (in_read,in_write) = Unix.pipe () in
- let (out_read,out_write) = Unix.pipe () in
- let pid = Unix.create_process prog args out_read in_write Unix.stderr in
+ let (ide2top_r,ide2top_w) = Unix.pipe () in
+ let (top2ide_r,top2ide_w) = Unix.pipe () in
+ let pid = Unix.create_process prog args ide2top_r top2ide_w top2ide_w in
assert (pid <> 0);
- Unix.close out_read;
- Unix.close in_write;
- let ic = Unix.in_channel_of_descr in_read in
- let oc = Unix.out_channel_of_descr out_write in
+ Unix.close ide2top_r;
+ Unix.close top2ide_w;
+ let oc = Unix.out_channel_of_descr ide2top_w in
+ let ic = Unix.in_channel_of_descr top2ide_r in
set_binary_mode_out oc true;
set_binary_mode_in ic true;
(pid,ic,oc)