aboutsummaryrefslogtreecommitdiffhomepage
path: root/ide/coqide_main.ml4
diff options
context:
space:
mode:
authorGravatar letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7>2011-04-21 16:12:31 +0000
committerGravatar letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7>2011-04-21 16:12:31 +0000
commit08642139dc3edf2caf94e7f246c15644daca16ad (patch)
tree11c772236ad3fa7ad0e20607760fb66f8e829a8e /ide/coqide_main.ml4
parent64643bc2889ba26007cea65e3bf8917a8595d7ed (diff)
Win32: if we make coqide console-free, then stderr/stdout/sdtin shouldn't be used
This is an adaptation of commit r13751 of branch 8.3 Even if coqide.exe keeps its console by default for the moment, we try to allow turning it off (for instance via the mkwinapp tool) : for that we need to be cautious about the use of functions like prerr_endline. Since stderr doesn't exists in this settings, such functions trigger a Sys_error "bad file descriptor". This patch protects many access to std** by a (try ... with _ ->()). Nota: with camlp5 < 6.02.1, Print Grammar was also generating such a Sys_error. TODO: we should try to figure a way of displaying messages (both debug and early/late error message). A log file ? A popup ? diplay in the response buffer ? git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@14040 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'ide/coqide_main.ml4')
-rw-r--r--ide/coqide_main.ml414
1 files changed, 11 insertions, 3 deletions
diff --git a/ide/coqide_main.ml4 b/ide/coqide_main.ml4
index c63db0031..9fc0f72b7 100644
--- a/ide/coqide_main.ml4
+++ b/ide/coqide_main.ml4
@@ -1,3 +1,11 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
IFDEF MacInt THEN
external gtk_mac_init : (string -> unit) -> (unit -> bool) -> unit
= "caml_gtk_mac_init"
@@ -41,9 +49,9 @@ let () =
try
GtkThread.main ()
with
- | Sys.Break -> prerr_endline "Interrupted." ; flush stderr
+ | Sys.Break -> Ideutils.prerr_endline "Interrupted." ; flush stderr
| e ->
- Pervasives.prerr_endline ("CoqIde unexpected error:" ^ (Printexc.to_string e));
- flush stderr;
+ Ideutils.safe_prerr_endline
+ ("CoqIde unexpected error:" ^ (Printexc.to_string e));
Coqide.crash_save 127
done