static void ide_subprocess_wait_check_cb (GObject *object, GAsyncResult *result, gpointer user_data) { IdeSubprocess *self = (IdeSubprocess *)object; g_autoptr(GTask) task = user_data; g_autoptr(GError) error = NULL; IDE_ENTRY; g_assert (IDE_IS_SUBPROCESS (self)); g_assert (G_IS_TASK (task)); if (!ide_subprocess_wait_finish (self, result, &error)) { g_task_return_error (task, g_steal_pointer (&error)); IDE_EXIT; } if (!ide_subprocess_check_exit_status (self, &error)) { g_task_return_error (task, g_steal_pointer (&error)); IDE_EXIT; } g_task_return_boolean (task, TRUE); IDE_EXIT; }
static void ide_subprocess_supervisor_wait_cb (GObject *object, GAsyncResult *result, gpointer user_data) { IdeSubprocess *subprocess = (IdeSubprocess *)object; g_autoptr(IdeSubprocessSupervisor) self = user_data; IdeSubprocessSupervisorPrivate *priv = ide_subprocess_supervisor_get_instance_private (self); g_autoptr(GError) error = NULL; g_return_if_fail (IDE_IS_SUBPROCESS_SUPERVISOR (self)); g_return_if_fail (IDE_IS_SUBPROCESS (subprocess)); if (!ide_subprocess_wait_finish (subprocess, result, &error)) g_warning ("%s", error->message); #ifdef IDE_ENABLE_TRACE { if (ide_subprocess_get_if_exited (subprocess)) IDE_TRACE_MSG ("process exited with code: %u", ide_subprocess_get_exit_status (subprocess)); else IDE_TRACE_MSG ("process terminated due to signal: %u", ide_subprocess_get_term_sig (subprocess)); } #endif /* * If we end up here in response to ide_subprocess_supervisor_reset() force * exiting the process, we won't successfully match * (priv->subprocess==subprocess) and therefore will not restart the process * immediately (allowing the caller of ide_subprocess_supervisor_reset() to * complete the operation. */ if (priv->subprocess == subprocess) { g_clear_object (&priv->subprocess); if (priv->supervising) { gint64 sleep_usec; if (ide_subprocess_supervisor_needs_rate_limit (self, &sleep_usec)) ide_subprocess_supervisor_start_in_usec (self, sleep_usec); else ide_subprocess_supervisor_start (self); } } }
static void gb_terminal_view_wait_cb (GObject *object, GAsyncResult *result, gpointer user_data) { IdeSubprocess *subprocess = (IdeSubprocess *)object; VteTerminal *terminal = user_data; GbTerminalView *self; g_autoptr(GError) error = NULL; IDE_ENTRY; g_assert (IDE_IS_SUBPROCESS (subprocess)); g_assert (G_IS_ASYNC_RESULT (result)); g_assert (VTE_IS_TERMINAL (terminal)); if (!ide_subprocess_wait_finish (subprocess, result, &error)) { g_warning ("%s", error->message); IDE_GOTO (failure); } self = (GbTerminalView *)gtk_widget_get_ancestor (GTK_WIDGET (terminal), GB_TYPE_TERMINAL_VIEW); if (self == NULL) IDE_GOTO (failure); if (!ide_widget_action (GTK_WIDGET (self), "view-stack", "close", NULL)) { if (!gtk_widget_in_destruction (GTK_WIDGET (terminal))) gb_terminal_respawn (self, terminal); } failure: g_clear_object (&terminal); IDE_EXIT; }