coredumpctl: Don't treat no coredumps as failure

Having to deal with a process that fails or doesn't fail depending on
whether there are coredumps or not is incredibly annoying for users.
This commit is contained in:
Daan De Meyer
2024-11-23 12:14:06 +01:00
committed by Mike Yuan
parent 67f8ddc967
commit dfe79b9ed2
2 changed files with 4 additions and 6 deletions

View File

@@ -389,10 +389,7 @@
<refsect1>
<title>Exit status</title>
<para>On success, 0 is returned; otherwise, a non-zero failure
code is returned. Not finding any matching core dumps is treated as
failure.
</para>
<para>On success, 0 is returned; otherwise, a non-zero failure code is returned.</para>
</refsect1>
<refsect1>

View File

@@ -963,9 +963,10 @@ static int dump_list(int argc, char **argv, void *userdata) {
}
if (!arg_field && n_found <= 0) {
if (!arg_quiet)
if (!arg_quiet && !sd_json_format_enabled(arg_json_format_flags))
log_notice("No coredumps found.");
return -ESRCH;
return 0;
}
}