History

Make it possible not to redirect stderr

Better solution is needed. If atexit handlers are suppressed then accumulated error messages are never presented to the user, some never leave OCaml turf.

malc committed 6 years ago

Commit dccb2e81 parent 0ab298c4 files · +21 −15Browse files

Unified · Split

4 files
  1. config.ml +1 −0
  2. ffi.ml +1 −1
  3. link.c +15 −13
  4. main.ml +4 −1
config.ml+1−0
@@ -85,6 +85,7 @@ and scrollb = int · 84 unmodified lines
85and anchor = pageno * top * dtop85and anchor = pageno * top * dtop
86and rect = float * float * float * float * float * float * float * float86and rect = float * float * float * float * float * float * float * float
87and infochange = | Memused | Docinfo | Pdim87and infochange = | Memused | Docinfo | Pdim
88and dupstderr = bool
88;;89;;
89 90
90class type uioh =91class type uioh =
ffi.ml+1−1
@@ -1,7 +1,7 @@
1open Config;;1open Config;;
2 2
3type initparams = (angle * fitmodel * trimparams * texcount * sliceheight *3type initparams = (angle * fitmodel * trimparams * texcount * sliceheight *
4 memsize * colorspace * fontpath);;4 memsize * colorspace * fontpath * dupstderr);;
5 5
6external init : Unix.file_descr -> initparams -> Unix.file_descr = "ml_init";;6external init : Unix.file_descr -> initparams -> Unix.file_descr = "ml_init";;
7external seltext : opaque -> (int * int * int * int) -> unit = "ml_seltext";;7external seltext : opaque -> (int * int * int * int) -> unit = "ml_seltext";;
link.c+15−13
@@ -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 CIDER3869#ifdef CIDER
3868 state.utf8cs = 1;3870 state.utf8cs = 1;
3869#else3871#else
main.ml+4−1
@@ -4869,6 +4869,7 @@ let remoteopen path = · 4868 unmodified lines
4869let () =4869let () =
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 in4871 let gcconfig = ref false in
4872 let redirstderr = ref true in
4872 let rcmdpath = ref E.s in4873 let rcmdpath = ref E.s in
4873 let dcfpath = ref None in4874 let dcfpath = ref None in
4874 let pageno = ref None in4875 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.fontpath5105 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);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t