diff options
Diffstat (limited to 'cparser/Cerrors.ml')
-rw-r--r-- | cparser/Cerrors.ml | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/cparser/Cerrors.ml b/cparser/Cerrors.ml index c50e12d9..a38cceee 100644 --- a/cparser/Cerrors.ml +++ b/cparser/Cerrors.ml @@ -21,7 +21,10 @@ open Commandline let error_fatal = ref false let color_diagnostics = let term = try Sys.getenv "TERM" with Not_found -> "" in - ref (Unix.isatty Unix.stderr && term <> "dumb" && term <>"") + let activate = try + (Unix.isatty Unix.stderr && term <> "dumb" && term <>"") + with _ -> false in + ref activate let num_errors = ref 0 let num_warnings = ref 0 @@ -197,7 +200,7 @@ let classify_warning w = SuppressedMsg,None let cprintf fmt c = - if Unix.isatty Unix.stderr && !color_diagnostics then + if !color_diagnostics then fprintf fmt c else ifprintf fmt c |