Better solution is needed. If atexit handlers are suppressed then accumulated error messages are never presented to the user, some never leave OCaml turf.
Unified · Split
| @@ -85,6 +85,7 @@ and scrollb = int · 84 unmodified lines | |||
| 85 | and anchor = pageno * top * dtop | 85 | and anchor = pageno * top * dtop |
| 86 | and rect = float * float * float * float * float * float * float * float | 86 | and rect = float * float * float * float * float * float * float * float |
| 87 | and infochange = | Memused | Docinfo | Pdim | 87 | and infochange = | Memused | Docinfo | Pdim |
| 88 | and dupstderr = bool | ||
| 88 | ;; | 89 | ;; |
| 89 | 90 | ||
| 90 | class type uioh = | 91 | class type uioh = |
| @@ -1,7 +1,7 @@ | |||
| 1 | open Config;; | 1 | open Config;; |
| 2 | 2 | ||
| 3 | type initparams = (angle * fitmodel * trimparams * texcount * sliceheight * | 3 | type initparams = (angle * fitmodel * trimparams * texcount * sliceheight * |
| 4 | memsize * colorspace * fontpath);; | 4 | memsize * colorspace * fontpath * dupstderr);; |
| 5 | 5 | ||
| 6 | external init : Unix.file_descr -> initparams -> Unix.file_descr = "ml_init";; | 6 | external init : Unix.file_descr -> initparams -> Unix.file_descr = "ml_init";; |
| 7 | external seltext : opaque -> (int * int * int * int) -> unit = "ml_seltext";; | 7 | external seltext : opaque -> (int * int * int * int) -> unit = "ml_seltext";; |
| @@ -3841,19 +3841,6 @@ ML (init (value csock_v, value params_v)) · 3840 unmodified lines | |||
| 3841 | int ret, texcount, colorspace, mustoresize; | 3841 | int ret, texcount, colorspace, mustoresize; |
| 3842 | const char *fontpath; | 3842 | const char *fontpath; |
| 3843 | 3843 | ||
| 3844 | if (pipe (state.pfds)) { | ||
| 3845 | err (1, "pipe"); | ||
| 3846 | } | ||
| 3847 | for (int ntries = 0; ntries < 1737; ++ntries) { | ||
| 3848 | if (-1 == dup2 (state.pfds[1], 2)) { | ||
| 3849 | if (EINTR == errno) { | ||
| 3850 | continue; | ||
| 3851 | } | ||
| 3852 | err (1, "dup2"); | ||
| 3853 | } | ||
| 3854 | break; | ||
| 3855 | } | ||
| 3856 | |||
| 3857 | state.csock = Int_val (csock_v); | 3844 | state.csock = Int_val (csock_v); |
| 3858 | state.rotate = Int_val (Field (params_v, 0)); | 3845 | state.rotate = Int_val (Field (params_v, 0)); |
| 3859 | state.fitmodel = Int_val (Field (params_v, 1)); | 3846 | state.fitmodel = Int_val (Field (params_v, 1)); |
| @@ -3864,6 +3851,21 @@ ML (init (value csock_v, value params_v)) · 4 unmodified lines | |||
| 3864 | colorspace = Int_val (Field (params_v, 6)); | 3851 | colorspace = Int_val (Field (params_v, 6)); |
| 3865 | fontpath = String_val (Field (params_v, 7)); | 3852 | fontpath = String_val (Field (params_v, 7)); |
| 3866 | 3853 | ||
| 3854 | if (Int_val (Field (params_v, 8))) { | ||
| 3855 | if (pipe (state.pfds)) { | ||
| 3856 | err (1, "pipe"); | ||
| 3857 | } | ||
| 3858 | for (int ntries = 0; ntries < 1737; ++ntries) { | ||
| 3859 | if (-1 == dup2 (state.pfds[1], 2)) { | ||
| 3860 | if (EINTR == errno) { | ||
| 3861 | continue; | ||
| 3862 | } | ||
| 3863 | err (1, "dup2"); | ||
| 3864 | } | ||
| 3865 | break; | ||
| 3866 | } | ||
| 3867 | } | ||
| 3868 | |||
| 3867 | #ifdef CIDER | 3869 | #ifdef CIDER |
| 3868 | state.utf8cs = 1; | 3870 | state.utf8cs = 1; |
| 3869 | #else | 3871 | #else |
| @@ -4869,6 +4869,7 @@ let remoteopen path = · 4868 unmodified lines | |||
| 4869 | let () = | 4869 | let () = |
| 4870 | vlogf := (fun s -> if conf.verbose then print_endline s else ignore s); | 4870 | vlogf := (fun s -> if conf.verbose then print_endline s else ignore s); |
| 4871 | let gcconfig = ref false in | 4871 | let gcconfig = ref false in |
| 4872 | let redirstderr = ref true in | ||
| 4872 | let rcmdpath = ref E.s in | 4873 | let rcmdpath = ref E.s in |
| 4873 | let dcfpath = ref None in | 4874 | let dcfpath = ref None in |
| 4874 | let pageno = ref None in | 4875 | let pageno = ref None in |
| @@ -4926,6 +4927,8 @@ let () = · 51 unmodified lines | |||
| 4926 | 4927 | ||
| 4927 | ("-layout-height", Arg.Set_int layouth, | 4928 | ("-layout-height", Arg.Set_int layouth, |
| 4928 | "<height> layout height html/epub/etc (-1, 0, N)"); | 4929 | "<height> layout height html/epub/etc (-1, 0, N)"); |
| 4930 | |||
| 4931 | ("-no-redir-stderr", Arg.Clear redirstderr, " do not redirect stderr"); | ||
| 4929 | ] | 4932 | ] |
| 4930 | ) | 4933 | ) |
| 4931 | (fun s -> state.path <- s) | 4934 | (fun s -> state.path <- s) |
| @@ -5099,7 +5102,7 @@ let () = · 167 unmodified lines | |||
| 5099 | Ffi.init cs ( | 5102 | Ffi.init cs ( |
| 5100 | conf.angle, conf.fitmodel, (conf.trimmargins, conf.trimfuzz), | 5103 | conf.angle, conf.fitmodel, (conf.trimmargins, conf.trimfuzz), |
| 5101 | conf.texcount, conf.sliceheight, conf.mustoresize, | 5104 | conf.texcount, conf.sliceheight, conf.mustoresize, |
| 5102 | conf.colorspace, !Config.fontpath | 5105 | conf.colorspace, !Config.fontpath, !redirstderr |
| 5103 | ); | 5106 | ); |
| 5104 | List.iter GlArray.enable [`texture_coord; `vertex]; | 5107 | List.iter GlArray.enable [`texture_coord; `vertex]; |
| 5105 | GlTex.env (`color conf.texturecolor); | 5108 | GlTex.env (`color conf.texturecolor); |