From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx> This uses -EINPROGRESS with commands scan and advertise since they need to keep running in the background so they don't exit but shouldn't block other command from executing in case they are invoked from a script. --- client/advertising.c | 4 +--- client/main.c | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/client/advertising.c b/client/advertising.c index 382ae420e663..6e1c70309fb5 100644 --- a/client/advertising.c +++ b/client/advertising.c @@ -238,7 +238,7 @@ static void register_reply(DBusMessage *message, void *user_data) ad.registered = true; bt_shell_printf("Advertising object registered\n"); print_ad(); - /* Leave advertise running even on noninteractive mode */ + return bt_shell_noninteractive_quit(-EINPROGRESS); } else { bt_shell_printf("Failed to register advertisement: %s\n", error.name); dbus_error_free(&error); @@ -874,8 +874,6 @@ static void ad_clear_service(int type) { g_free(ad.service[type].uuid); memset(&ad.service[type], 0, sizeof(ad.service[type])); - - return bt_shell_noninteractive_quit(EXIT_SUCCESS); } static bool ad_add_data(struct ad_data *data, int argc, char *argv[]) diff --git a/client/main.c b/client/main.c index c2321952bd4f..d99a5158e35a 100644 --- a/client/main.c +++ b/client/main.c @@ -1219,7 +1219,8 @@ static void start_discovery_reply(DBusMessage *message, void *user_data) bt_shell_printf("Discovery %s\n", enable ? "started" : "stopped"); filter.active = enable; - /* Leave the discovery running even on noninteractive mode */ + + return bt_shell_noninteractive_quit(-EINPROGRESS); } static void clear_discovery_filter(DBusMessageIter *iter, void *user_data) -- 2.49.0