nmcli: be less insistant on exiting when readline() gets no input

When the input ends, we indeed eventually want to shut down.

Nevertheless, it might be that we terminated the input *because* we're
already shutting down and want do do our cleanup. Let's not take the
shortcut to nmc_exit() in case the main loop is no longer running.

This doesn't affect existing uses of nmc_readline(), but will be useful
in a future patch.
This commit is contained in:
Lubomir Rintel 2022-05-04 09:20:01 +02:00
parent 5f9d2927ed
commit 47eaf963e3

View file

@ -929,7 +929,8 @@ read_again:
}
} else if (!rl_string) {
/* Ctrl-D, exit */
nmc_exit();
if (g_main_loop_is_running(loop))
nmc_exit();
}
/* Return NULL, not empty string */