From bf4ffc43c58a78ff8f1a8efcc67781da7ba3ef57 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 20 Nov 2023 14:52:31 +0100 Subject: [PATCH] analyze: teach "exit-status" verb json output too --- src/analyze/analyze-exit-status.c | 6 ++---- src/analyze/analyze.c | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/analyze/analyze-exit-status.c b/src/analyze/analyze-exit-status.c index 3a8d3f4b2a9..1032f1a4b7a 100644 --- a/src/analyze/analyze-exit-status.c +++ b/src/analyze/analyze-exit-status.c @@ -46,11 +46,9 @@ int verb_exit_status(int argc, char *argv[], void *userdata) { return table_log_add_error(r); } - pager_open(arg_pager_flags); - - r = table_print(table, NULL); + r = table_print_with_pager(table, arg_json_format_flags, arg_pager_flags, arg_legend); if (r < 0) - return r; + return log_error_errno(r, "Failed to output table: %m"); return EXIT_SUCCESS; } diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c index 2c230e08199..005846fdeee 100644 --- a/src/analyze/analyze.c +++ b/src/analyze/analyze.c @@ -558,9 +558,9 @@ static int parse_argv(int argc, char *argv[]) { return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Option --offline= is only supported for security right now."); - if (arg_json_format_flags != JSON_FORMAT_OFF && !STRPTR_IN_SET(argv[optind], "security", "inspect-elf", "plot", "fdstore", "pcrs", "architectures", "capability")) + if (arg_json_format_flags != JSON_FORMAT_OFF && !STRPTR_IN_SET(argv[optind], "security", "inspect-elf", "plot", "fdstore", "pcrs", "architectures", "capability", "exit-status")) return log_error_errno(SYNTHETIC_ERRNO(EINVAL), - "Option --json= is only supported for security, inspect-elf, plot, fdstore, pcrs, architectures, capability right now."); + "Option --json= is only supported for security, inspect-elf, plot, fdstore, pcrs, architectures, capability, exit-status right now."); if (arg_threshold != 100 && !streq_ptr(argv[optind], "security")) return log_error_errno(SYNTHETIC_ERRNO(EINVAL), -- 2.39.2