From 1c3b1e6ad8911effb73ad68de1a809049a2ee3e4 Mon Sep 17 00:00:00 2001 From: malc Date: Sun, 2 Jun 2013 20:03:49 +0400 Subject: [PATCH] Wish i had a better idea how to do that --- main.ml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/main.ml b/main.ml index 2928058..f9c8355 100644 --- a/main.ml +++ b/main.ml @@ -7592,6 +7592,31 @@ let () = setcheckers conf.checkers; redirectstderr (); + if conf.redirectstderr + then + at_exit (fun () -> + let s = Buffer.contents state.errmsgs ^ + (match state.errfd with + | Some fd -> + let s = String.create (80*24) in + let n = + try + let r, _, _ = Unix.select [fd] [] [] 0.0 in + if List.mem fd r + then Unix.read fd s 0 (String.length s) + else 0 + with _ -> 0 + in + if n = 0 + then "" + else String.sub s 0 n + | None -> "" + ) + in + try ignore (Unix.write state.stderr s 0 (String.length s)) + with exn -> print_endline (exntos exn) + ) + ; init (cr, cw) ( conf.angle, conf.fitmodel, (conf.trimmargins, conf.trimfuzz), -- 2.11.4.GIT