From b214ab9f826eafdcb2fa0d0681ec138696852a96 Mon Sep 17 00:00:00 2001 From: Chong Shen Ng Date: Tue, 17 Dec 2024 19:54:45 +0000 Subject: [PATCH] fix(framework) Suppress output when in JSON format for `flwr ls` (#4734) --- src/py/flwr/cli/ls.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/py/flwr/cli/ls.py b/src/py/flwr/cli/ls.py index 9c30a158952f..0b6ea3918778 100644 --- a/src/py/flwr/cli/ls.py +++ b/src/py/flwr/cli/ls.py @@ -99,7 +99,6 @@ def ls( # pylint: disable=too-many-locals, too-many-branches try: if suppress_output: redirect_output(captured_output) - # Load and validate federation config typer.secho("Loading project configuration... ", fg=typer.colors.BLUE) @@ -132,6 +131,8 @@ def ls( # pylint: disable=too-many-locals, too-many-branches _list_runs(stub, output_format) except ValueError as err: + if suppress_output: + redirect_output(captured_output) typer.secho( f"❌ {err}", fg=typer.colors.RED,