Compare commits

...

2 Commits

Author SHA1 Message Date
Daan De Meyer 922ae92aab
Merge ea8c6b4b80 into 7a9d0abe4d 2024-11-26 11:54:28 +01:00
Daan De Meyer ea8c6b4b80 coredumpctl: Don't treat no coredumps as failure if JSON is enabled
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.
So let's compromise and not fail if JSON output is enabled and there
are no coredumps.
2024-11-24 23:25:55 +01:00
2 changed files with 4 additions and 2 deletions

View File

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

View File

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