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.
This commit is contained in:
Lubomir Rintel 2016-06-23 17:45:59 +02:00
parent 56804f4a3f
commit ef8d696252
2 changed files with 3 additions and 6 deletions

View file

@ -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;
}

View file

@ -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);