From b48710aac7db4258341cabcefdfd0fafa4cecf23 Mon Sep 17 00:00:00 2001 From: Mario Limonciello Date: Wed, 24 Aug 2022 13:00:23 -0500 Subject: [PATCH] trivial: fu-util: make JSON mode silent We don't want to be emitting errors in JSON mode, we should only use return codes. --- src/fu-util.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/fu-util.c b/src/fu-util.c index fd2eba185..67243901c 100644 --- a/src/fu-util.c +++ b/src/fu-util.c @@ -4683,14 +4683,15 @@ main(int argc, char *argv[]) return EXIT_FAILURE; } #endif - g_printerr("%s\n", error->message); + if (priv->as_json) + g_debug("%s\n", error->message); + else + g_printerr("%s\n", error->message); if (g_error_matches(error, FWUPD_ERROR, FWUPD_ERROR_INVALID_ARGS)) { /* TRANSLATORS: error message explaining command on how to get help */ g_printerr("\n%s\n", _("Use fwupdmgr --help for help")); - } else if (g_error_matches(error, FWUPD_ERROR, FWUPD_ERROR_NOTHING_TO_DO)) { - g_debug("%s\n", error->message); + } else if (g_error_matches(error, FWUPD_ERROR, FWUPD_ERROR_NOTHING_TO_DO)) return EXIT_NOTHING_TO_DO; - } return EXIT_FAILURE; }