Improve rendering of errors

This commit is contained in:
Jeremie Dimino 2017-02-23 11:55:14 +00:00
parent 901d9acc2a
commit aa5c4078f7
2 changed files with 19 additions and 4 deletions

View File

@ -268,10 +268,24 @@ module Scheduler = struct
flush oc
);
if not exiting then begin
if output <> "" then
Printf.eprintf "Output[%d]:\n%s%!" job.id output;
handle_process_status job status;
Ivar.fill job.job.ivar ()
match status with
| WEXITED 0 ->
if output <> "" then
Printf.eprintf "Output[%d]:\n%s%!" job.id output;
Ivar.fill job.job.ivar ()
| WEXITED n ->
Printf.eprintf "\nCommand [%d] exited with code %d:\n$ %s\n%s%!"
job.id n
(strip_colors_for_stderr job.command_line)
(strip_colors_for_stderr output);
die ""
| WSIGNALED n ->
Printf.eprintf "\nCommand [%d] got signal %d:\n$ %s\n%s%!"
job.id n
(strip_colors_for_stderr job.command_line)
(strip_colors_for_stderr output);
die ""
| WSTOPPED _ -> assert false
end
let gen_id =

View File

@ -32,6 +32,7 @@ let report_error ?(map_fname=fun x->x) ppf exn ~backtrace =
"File \"%s\", line %d, characters %d-%d:\n\
Error: %s\n"
(map_fname start.pos_fname) start.pos_lnum start_c stop_c msg
| Fatal_error "" -> ()
| Fatal_error msg ->
Format.fprintf ppf "%s\n" (String.capitalize msg)
| Findlib.Package_not_found pkg ->