From ef8d696252bd36a9d495cad1e2527a311aa2bdf5 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Thu, 23 Jun 2016 17:45:59 +0200 Subject: [PATCH] cli: move the final completion check after the main loop exit For "nmcli d modify" we'll need to do the completion from async handlers. This seems to be the most reasonable place to ignore the errors. --- clients/cli/connections.c | 6 ------ clients/cli/nmcli.c | 3 +++ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/clients/cli/connections.c b/clients/cli/connections.c index caf151fc51..bbe8b78b31 100644 --- a/clients/cli/connections.c +++ b/clients/cli/connections.c @@ -4758,9 +4758,6 @@ finish: if (connection) g_object_unref (connection); - /* shell completion - be sure to exit with success without printing errors */ - if (nmc->complete) - nmc->return_value = NMC_RESULT_SUCCESS; return nmc->return_value; } @@ -7818,9 +7815,6 @@ do_connection_modify (NmCli *nmc, nmc->should_wait++; finish: - /* shell completion - be sure to exit with success without printing errors */ - if (nmc->complete) - nmc->return_value = NMC_RESULT_SUCCESS; return nmc->return_value; } diff --git a/clients/cli/nmcli.c b/clients/cli/nmcli.c index 84bb4a23df..a203e407c3 100644 --- a/clients/cli/nmcli.c +++ b/clients/cli/nmcli.c @@ -640,6 +640,9 @@ main (int argc, char *argv[]) loop = g_main_loop_new (NULL, FALSE); /* create main loop */ g_main_loop_run (loop); /* run main loop */ + if (nm_cli.complete) + nm_cli.return_value = NMC_RESULT_SUCCESS; + /* Print result descripting text */ if (nm_cli.return_value != NMC_RESULT_SUCCESS) { g_printerr ("%s\n", nm_cli.return_text->str);