Print background process failures when exiting
This commit is contained in:
parent
550a8d8f57
commit
60d09f7e27
|
@ -491,54 +491,53 @@ module Scheduler = struct
|
||||||
~command_line:job.command_line
|
~command_line:job.command_line
|
||||||
~output:output
|
~output:output
|
||||||
~exit_status:status;
|
~exit_status:status;
|
||||||
if not exiting then begin
|
let _, progname, _ = split_prog job.job.prog in
|
||||||
let _, progname, _ = split_prog job.job.prog in
|
match status with
|
||||||
match status with
|
| WEXITED n when code_is_ok job.job.ok_codes n ->
|
||||||
| WEXITED n when code_is_ok job.job.ok_codes n ->
|
if !Clflags.verbose then begin
|
||||||
if !Clflags.verbose then begin
|
if output <> "" then
|
||||||
if output <> "" then
|
Format.eprintf "@{<kwd>Output@}[@{<id>%d@}]:\n%s%!" job.id output;
|
||||||
Format.eprintf "@{<kwd>Output@}[@{<id>%d@}]:\n%s%!" job.id output;
|
if n <> 0 then
|
||||||
if n <> 0 then
|
Format.eprintf
|
||||||
Format.eprintf
|
"@{<warning>Warning@}: Command [@{<id>%d@}] exited with code %d, \
|
||||||
"@{<warning>Warning@}: Command [@{<id>%d@}] exited with code %d, \
|
but I'm ignore it, hope that's OK.\n%!" job.id n;
|
||||||
but I'm ignore it, hope that's OK.\n%!" job.id n;
|
end else if not exiting && (output <> "" || job.job.purpose <> Internal_job) then
|
||||||
end else if output <> "" || job.job.purpose <> Internal_job then begin
|
begin
|
||||||
Format.eprintf "@{<ok>%12s@} %a@." progname pp_purpose job.job.purpose;
|
Format.eprintf "@{<ok>%12s@} %a@." progname pp_purpose job.job.purpose;
|
||||||
Format.eprintf "%s%!" output;
|
Format.eprintf "%s%!" output;
|
||||||
end;
|
end;
|
||||||
Ivar.fill job.job.ivar n
|
if not exiting then Ivar.fill job.job.ivar n
|
||||||
| WEXITED n ->
|
| WEXITED n ->
|
||||||
if !Clflags.verbose then begin
|
if !Clflags.verbose then begin
|
||||||
Format.eprintf "\n@{<kwd>Command@} [@{<id>%d@}] exited with code %d:\n\
|
Format.eprintf "\n@{<kwd>Command@} [@{<id>%d@}] exited with code %d:\n\
|
||||||
@{<prompt>$@} %s\n%s%!"
|
@{<prompt>$@} %s\n%s%!"
|
||||||
job.id n
|
job.id n
|
||||||
(Ansi_color.strip_colors_for_stderr job.command_line)
|
(Ansi_color.strip_colors_for_stderr job.command_line)
|
||||||
(Ansi_color.strip_colors_for_stderr output)
|
(Ansi_color.strip_colors_for_stderr output)
|
||||||
end else begin
|
end else begin
|
||||||
Format.eprintf "@{<error>%12s@} %a @{<error>(exit %d)@}@."
|
Format.eprintf "@{<error>%12s@} %a @{<error>(exit %d)@}@."
|
||||||
progname pp_purpose job.job.purpose n;
|
progname pp_purpose job.job.purpose n;
|
||||||
Format.eprintf "@{<details>%s@}@."
|
Format.eprintf "@{<details>%s@}@."
|
||||||
(Ansi_color.strip job.command_line);
|
(Ansi_color.strip job.command_line);
|
||||||
Format.eprintf "%s%!" output;
|
Format.eprintf "%s%!" output;
|
||||||
end;
|
end;
|
||||||
die ""
|
if not exiting then die ""
|
||||||
| WSIGNALED n ->
|
| WSIGNALED n ->
|
||||||
if !Clflags.verbose then begin
|
if !Clflags.verbose then begin
|
||||||
Format.eprintf "\n@{<kwd>Command@} [@{<id>%d@}] got signal %s:\n\
|
Format.eprintf "\n@{<kwd>Command@} [@{<id>%d@}] got signal %s:\n\
|
||||||
@{<prompt>$@} %s\n%s%!"
|
@{<prompt>$@} %s\n%s%!"
|
||||||
job.id (Utils.signal_name n)
|
job.id (Utils.signal_name n)
|
||||||
(Ansi_color.strip_colors_for_stderr job.command_line)
|
(Ansi_color.strip_colors_for_stderr job.command_line)
|
||||||
(Ansi_color.strip_colors_for_stderr output);
|
(Ansi_color.strip_colors_for_stderr output);
|
||||||
end else begin
|
end else begin
|
||||||
Format.eprintf "@{<error>%12s@} %a @{<error>(got signal %s)@}@."
|
Format.eprintf "@{<error>%12s@} %a @{<error>(got signal %s)@}@."
|
||||||
progname pp_purpose job.job.purpose (Utils.signal_name n);
|
progname pp_purpose job.job.purpose (Utils.signal_name n);
|
||||||
Format.eprintf "@{<details>%s@}@."
|
Format.eprintf "@{<details>%s@}@."
|
||||||
(Ansi_color.strip job.command_line);
|
(Ansi_color.strip job.command_line);
|
||||||
Format.eprintf "%s%!" output;
|
Format.eprintf "%s%!" output;
|
||||||
end;
|
end;
|
||||||
die ""
|
if not exiting then die ""
|
||||||
| WSTOPPED _ -> assert false;
|
| WSTOPPED _ -> assert false
|
||||||
end
|
|
||||||
|
|
||||||
let gen_id =
|
let gen_id =
|
||||||
let next = ref (-1) in
|
let next = ref (-1) in
|
||||||
|
|
|
@ -88,7 +88,12 @@
|
||||||
((name sleep1-and-fail)
|
((name sleep1-and-fail)
|
||||||
(action (system "sleep 1; exit 1"))))
|
(action (system "sleep 1; exit 1"))))
|
||||||
|
|
||||||
|
(alias
|
||||||
|
((name sleep4-and-fail)
|
||||||
|
(action (system "sleep 4; exit 1"))))
|
||||||
|
|
||||||
(alias
|
(alias
|
||||||
((name fail-with-background-jobs-running)
|
((name fail-with-background-jobs-running)
|
||||||
(deps ((alias sleep5)
|
(deps ((alias sleep5)
|
||||||
|
(alias sleep4-and-fail)
|
||||||
(alias sleep1-and-fail)))))
|
(alias sleep1-and-fail)))))
|
||||||
|
|
Loading…
Reference in New Issue