|
@@ -989,6 +989,7 @@ try
|
|
Gencpp.generate com;
|
|
Gencpp.generate com;
|
|
);
|
|
);
|
|
end;
|
|
end;
|
|
|
|
+ Sys.catch_break false;
|
|
if not !no_output then List.iter (fun cmd ->
|
|
if not !no_output then List.iter (fun cmd ->
|
|
let h = Hashtbl.create 0 in
|
|
let h = Hashtbl.create 0 in
|
|
Hashtbl.add h "__file__" com.file;
|
|
Hashtbl.add h "__file__" com.file;
|
|
@@ -1015,13 +1016,13 @@ try
|
|
let is_process_running() =
|
|
let is_process_running() =
|
|
fst (Unix.waitpid [Unix.WNOHANG] (-1)) = 0
|
|
fst (Unix.waitpid [Unix.WNOHANG] (-1)) = 0
|
|
in
|
|
in
|
|
- let rec loop() =
|
|
|
|
- let (ch,_,_), timeout = (try Unix.select [iout;ierr] [] [] 0.02, true with _ -> ([],[],[]),false) in
|
|
|
|
|
|
+ let rec loop ins =
|
|
|
|
+ let (ch,_,_), timeout = (try Unix.select ins [] [] 0.02, true with _ -> ([],[],[]),false) in
|
|
match ch with
|
|
match ch with
|
|
| [] ->
|
|
| [] ->
|
|
(* make sure we read all *)
|
|
(* make sure we read all *)
|
|
if timeout && is_process_running() then
|
|
if timeout && is_process_running() then
|
|
- loop()
|
|
|
|
|
|
+ loop ins
|
|
else begin
|
|
else begin
|
|
Buffer.add_string berr (IO.read_all (IO.input_channel perr));
|
|
Buffer.add_string berr (IO.read_all (IO.input_channel perr));
|
|
Buffer.add_string bout (IO.read_all (IO.input_channel pout));
|
|
Buffer.add_string bout (IO.read_all (IO.input_channel pout));
|
|
@@ -1029,11 +1030,9 @@ try
|
|
| s :: _ ->
|
|
| s :: _ ->
|
|
let n = Unix.read s tmp 0 (String.length tmp) in
|
|
let n = Unix.read s tmp 0 (String.length tmp) in
|
|
Buffer.add_substring (if s == iout then bout else berr) tmp 0 n;
|
|
Buffer.add_substring (if s == iout then bout else berr) tmp 0 n;
|
|
- loop()
|
|
|
|
|
|
+ loop (if n = 0 then List.filter ((!=) s) ins else ins)
|
|
in
|
|
in
|
|
- Sys.catch_break false;
|
|
|
|
- loop();
|
|
|
|
- Sys.catch_break true;
|
|
|
|
|
|
+ loop [iout;ierr];
|
|
let serr = binary_string (Buffer.contents berr) in
|
|
let serr = binary_string (Buffer.contents berr) in
|
|
let sout = binary_string (Buffer.contents bout) in
|
|
let sout = binary_string (Buffer.contents bout) in
|
|
if serr <> "" then ctx.messages <- (if serr.[String.length serr - 1] = '\n' then String.sub serr 0 (String.length serr - 1) else serr) :: ctx.messages;
|
|
if serr <> "" then ctx.messages <- (if serr.[String.length serr - 1] = '\n' then String.sub serr 0 (String.length serr - 1) else serr) :: ctx.messages;
|