diff --git a/tools/test-runner.c b/tools/test-runner.c index 16d6f13e..0f0499cb 100644 --- a/tools/test-runner.c +++ b/tools/test-runner.c @@ -941,62 +941,19 @@ static bool configure_hostapd_instances(struct l_settings *hw_settings, return true; } -static void iwd_appeared(struct l_dbus *dbus, void *user_data) -{ - l_info("IWD service has appeared\n"); - l_main_quit(); -} - -static void iwd_disappeared(struct l_dbus *dbus, void *user_data) -{ - l_info("IWD service has disappeared\n"); - l_main_quit(); -} - static pid_t start_iwd(void) { char *argv[2]; - pid_t pid; - uint32_t watch_id; argv[0] = "/usr/bin/iwd"; argv[1] = NULL; - pid = fork(); - if (pid < 0) { - perror("Failed to fork new process"); - return -1; - } - - if (pid == 0) { - set_output_visibility(); - - execv(argv[0], argv); - - exit(EXIT_FAILURE); - } - - watch_id = l_dbus_add_service_watch(g_dbus, "net.connman.iwd", - iwd_appeared, NULL, - NULL, NULL); - l_main_run(); - - l_dbus_remove_watch(g_dbus, watch_id); - - return pid; + return execute_program(argv, false); } static void terminate_iwd(pid_t iwd_pid) { - uint32_t watch_id; - - watch_id = l_dbus_add_service_watch(g_dbus, "net.connman.iwd", NULL, - iwd_disappeared, NULL, NULL); kill_process(iwd_pid); - - l_main_run(); - - l_dbus_remove_watch(g_dbus, watch_id); } #define CONSOLE_LN_DEFAULT "\x1B[0m"