gboolean ide_subprocess_get_if_signaled (IdeSubprocess *self) { g_return_val_if_fail (IDE_IS_SUBPROCESS (self), FALSE); return WRAP_INTERFACE_METHOD (self, get_if_signaled, FALSE); }
void ide_subprocess_force_exit (IdeSubprocess *self) { g_return_if_fail (IDE_IS_SUBPROCESS (self)); WRAP_INTERFACE_METHOD (self, force_exit, NULL); }
const gchar * ide_subprocess_get_identifier (IdeSubprocess *self) { g_return_val_if_fail (IDE_IS_SUBPROCESS (self), NULL); return WRAP_INTERFACE_METHOD (self, get_identifier, NULL); }
/** * ide_subprocess_get_stdin_pipe: * * Returns: (transfer none): A #GOutputStream or %NULL. */ GOutputStream * ide_subprocess_get_stdin_pipe (IdeSubprocess *self) { g_return_val_if_fail (IDE_IS_SUBPROCESS (self), NULL); return WRAP_INTERFACE_METHOD (self, get_stdin_pipe, NULL); }
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; }
gint ide_subprocess_get_status (IdeSubprocess *self) { g_return_val_if_fail (IDE_IS_SUBPROCESS (self), 0); return WRAP_INTERFACE_METHOD (self, get_status, 0); }
void ide_subprocess_send_signal (IdeSubprocess *self, gint signal_num) { g_return_if_fail (IDE_IS_SUBPROCESS (self)); WRAP_INTERFACE_METHOD (self, send_signal, NULL, signal_num); }
gboolean ide_subprocess_wait_finish (IdeSubprocess *self, GAsyncResult *result, GError **error) { g_return_val_if_fail (IDE_IS_SUBPROCESS (self), FALSE); return WRAP_INTERFACE_METHOD (self, wait_finish, FALSE, result, error); }
gboolean ide_subprocess_wait (IdeSubprocess *self, GCancellable *cancellable, GError **error) { g_return_val_if_fail (IDE_IS_SUBPROCESS (self), FALSE); g_return_val_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable), FALSE); return WRAP_INTERFACE_METHOD (self, wait, FALSE, cancellable, error); }
gboolean ide_subprocess_wait_check_finish (IdeSubprocess *self, GAsyncResult *result, GError **error) { g_return_val_if_fail (IDE_IS_SUBPROCESS (self), FALSE); g_return_val_if_fail (G_IS_TASK (result), FALSE); g_return_val_if_fail (g_task_is_valid (G_TASK (result), self), FALSE); return g_task_propagate_boolean (G_TASK (result), error); }
void ide_subprocess_wait_async (IdeSubprocess *self, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { g_return_if_fail (IDE_IS_SUBPROCESS (self)); g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable)); WRAP_INTERFACE_METHOD (self, wait_async, NULL, cancellable, callback, user_data); }
gboolean ide_subprocess_wait_check (IdeSubprocess *self, GCancellable *cancellable, GError **error) { g_return_val_if_fail (IDE_IS_SUBPROCESS (self), FALSE); g_return_val_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable), FALSE); return ide_subprocess_wait (self, cancellable, error) && ide_subprocess_check_exit_status (self, error); }
gboolean ide_subprocess_check_exit_status (IdeSubprocess *self, GError **error) { gint exit_status; g_return_val_if_fail (IDE_IS_SUBPROCESS (self), FALSE); exit_status = ide_subprocess_get_exit_status (self); return g_spawn_check_exit_status (exit_status, error); }
gboolean ide_subprocess_communicate_finish (IdeSubprocess *self, GAsyncResult *result, GBytes **stdout_buf, GBytes **stderr_buf, GError **error) { g_return_val_if_fail (IDE_IS_SUBPROCESS (self), FALSE); g_return_val_if_fail (G_IS_ASYNC_RESULT (result), FALSE); return WRAP_INTERFACE_METHOD (self, communicate_finish, FALSE, result, stdout_buf, stderr_buf, error); }
/** * ide_subprocess_communicate_utf8: * @self: an #IdeSubprocess * @stdin_buf: (nullable): input to deliver to the subprocesses stdin stream * @cancellable: (nullable): an optional #GCancellable * @stdout_buf: (out) (nullable): an optional location for the stdout contents * @stderr_buf: (out) (nullable): an optional location for the stderr contents * * This process acts identical to g_subprocess_communicate_utf8(). * * Returns: %TRUE if successful; otherwise %FALSE and @error is set. */ gboolean ide_subprocess_communicate_utf8 (IdeSubprocess *self, const gchar *stdin_buf, GCancellable *cancellable, gchar **stdout_buf, gchar **stderr_buf, GError **error) { g_return_val_if_fail (IDE_IS_SUBPROCESS (self), FALSE); g_return_val_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable), FALSE); return WRAP_INTERFACE_METHOD (self, communicate_utf8, FALSE, stdin_buf, cancellable, stdout_buf, stderr_buf, error); }
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 gbp_vagrant_runtime_provider_command_cb (IdeSubprocess *subprocess, GAsyncResult *result, gpointer user_data) { g_autofree gchar *stdout_buf = NULL; g_autoptr(IdeTask) task = user_data; g_autoptr(GError) error = NULL; g_assert (IDE_IS_SUBPROCESS (subprocess)); g_assert (G_IS_ASYNC_RESULT (result)); g_assert (IDE_IS_TASK (task)); if (!ide_subprocess_communicate_utf8_finish (subprocess, result, &stdout_buf, NULL, &error)) ide_task_return_error (task, g_steal_pointer (&error)); else ide_task_return_pointer (task, gbp_vagrant_table_new_take (g_steal_pointer (&stdout_buf)), gbp_vagrant_table_free); }
void ide_subprocess_supervisor_set_subprocess (IdeSubprocessSupervisor *self, IdeSubprocess *subprocess) { IdeSubprocessSupervisorPrivate *priv = ide_subprocess_supervisor_get_instance_private (self); g_return_if_fail (IDE_IS_SUBPROCESS_SUPERVISOR (self)); g_return_if_fail (!subprocess || IDE_IS_SUBPROCESS (subprocess)); if (g_set_object (&priv->subprocess, subprocess)) { if (subprocess != NULL) { g_get_current_time (&priv->last_spawn_time); ide_subprocess_wait_async (priv->subprocess, NULL, ide_subprocess_supervisor_wait_cb, g_object_ref (self)); g_signal_emit (self, signals [SPAWNED], 0, subprocess); } } }
void ide_subprocess_wait_check_async (IdeSubprocess *self, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { g_autoptr(GTask) task = NULL; IDE_ENTRY; g_return_if_fail (IDE_IS_SUBPROCESS (self)); g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable)); task = g_task_new (self, cancellable, callback, user_data); g_task_set_source_tag (task, ide_subprocess_wait_check_async); ide_subprocess_wait_async (self, cancellable, ide_subprocess_wait_check_cb, g_steal_pointer (&task)); IDE_EXIT; }
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; }