IdeSubprocess: Builder SDK Reference

## IdeSubprocess IdeSubprocess |

## Functions

const gchar * | ide_subprocess_get_identifier ()
GInputStream * | ide_subprocess_get_stdout_pipe ()
GInputStream * | ide_subprocess_get_stderr_pipe ()
GOutputStream * | ide_subprocess_get_stdin_pipe ()
gboolean | ide_subprocess_wait ()
gboolean | ide_subprocess_wait_check ()
void | ide_subprocess_wait_async ()
gboolean | ide_subprocess_wait_finish ()
void | ide_subprocess_wait_check_async ()
gboolean | ide_subprocess_wait_check_finish ()
gboolean | ide_subprocess_check_exit_status ()
gboolean | ide_subprocess_get_successful ()
gboolean | ide_subprocess_get_if_exited ()
gint | ide_subprocess_get_exit_status ()
gboolean | ide_subprocess_get_if_signaled ()
gint | ide_subprocess_get_term_sig ()
gint | ide_subprocess_get_status ()
void | ide_subprocess_send_signal ()
void | ide_subprocess_force_exit ()
gboolean | ide_subprocess_communicate ()
gboolean | ide_subprocess_communicate_utf8 ()
void | ide_subprocess_communicate_async ()
gboolean | ide_subprocess_communicate_finish ()
void | ide_subprocess_communicate_utf8_async ()
gboolean | ide_subprocess_communicate_utf8_finish ()

## Types and Values

#define | IDE_TYPE_SUBPROCESS
struct | IdeSubprocessInterface
| IdeSubprocess

## Object Hierarchy

        GInterface
        ╰── IdeSubprocess

## Prerequisites

IdeSubprocess requires GObject.

## Description

## Functions

### ide_subprocess_get_identifier ()

    const gchar *
    ide_subprocess_get_identifier (IdeSubprocess *self);

### ide_subprocess_get_stdout_pipe ()

    GInputStream *
    ide_subprocess_get_stdout_pipe (IdeSubprocess *self);

#### Returns

a GInputStream or `NULL`.

[transfer none]

### ide_subprocess_get_stderr_pipe ()

    GInputStream *
    ide_subprocess_get_stderr_pipe (IdeSubprocess *self);

#### Returns

a GInputStream or `NULL`.

[transfer none]

### ide_subprocess_get_stdin_pipe ()

    GOutputStream *
    ide_subprocess_get_stdin_pipe (IdeSubprocess *self);

#### Returns

a GOutputStream or `NULL`.

[transfer none]

### ide_subprocess_wait ()

    gboolean
    ide_subprocess_wait (IdeSubprocess *self,
                         GCancellable *cancellable,
                         GError **error);

### ide_subprocess_wait_check ()

    gboolean
    ide_subprocess_wait_check (IdeSubprocess *self,
                               GCancellable *cancellable,
                               GError **error);

### ide_subprocess_wait_async ()

    void
    ide_subprocess_wait_async (IdeSubprocess *self,
                               GCancellable *cancellable,
                               GAsyncReadyCallback callback,
                               gpointer user_data);

### ide_subprocess_wait_finish ()

    gboolean
    ide_subprocess_wait_finish (IdeSubprocess *self,
                                GAsyncResult *result,
                                GError **error);

### ide_subprocess_wait_check_async ()

    void
    ide_subprocess_wait_check_async (IdeSubprocess *self,
                                     GCancellable *cancellable,
                                     GAsyncReadyCallback callback,
                                     gpointer user_data);

### ide_subprocess_wait_check_finish ()

    gboolean
    ide_subprocess_wait_check_finish (IdeSubprocess *self,
                                      GAsyncResult *result,
                                      GError **error);

### ide_subprocess_check_exit_status ()

    gboolean
    ide_subprocess_check_exit_status (IdeSubprocess *self,
                                      GError **error);

### ide_subprocess_get_successful ()

    gboolean
    ide_subprocess_get_successful (IdeSubprocess *self);

### ide_subprocess_get_if_exited ()

    gboolean
    ide_subprocess_get_if_exited (IdeSubprocess *self);

### ide_subprocess_get_exit_status ()

    gint
    ide_subprocess_get_exit_status (IdeSubprocess *self);

### ide_subprocess_get_if_signaled ()

    gboolean
    ide_subprocess_get_if_signaled (IdeSubprocess *self);

### ide_subprocess_get_term_sig ()

    gint
    ide_subprocess_get_term_sig (IdeSubprocess *self);

### ide_subprocess_get_status ()

    gint
    ide_subprocess_get_status (IdeSubprocess *self);

### ide_subprocess_send_signal ()

    void
    ide_subprocess_send_signal (IdeSubprocess *self,
                                gint signal_num);

### ide_subprocess_force_exit ()

    void
    ide_subprocess_force_exit (IdeSubprocess *self);

### ide_subprocess_communicate ()

    gboolean
    ide_subprocess_communicate (IdeSubprocess *self,
                                GBytes *stdin_buf,
                                GCancellable *cancellable,
                                GBytes **stdout_buf,
                                GBytes **stderr_buf,
                                GError **error);

### ide_subprocess_communicate_utf8 ()

    gboolean
    ide_subprocess_communicate_utf8 (IdeSubprocess *self,
                                     const gchar *stdin_buf,
                                     GCancellable *cancellable,
                                     gchar **stdout_buf,
                                     gchar **stderr_buf,
                                     GError **error);

This process acts identical to `g_subprocess_communicate_utf8()`.

#### Parameters

self | an IdeSubprocess |
stdin_buf | input to deliver to the subprocesses stdin stream. | [nullable]
cancellable | an optional GCancellable. | [nullable]
stdout_buf | an optional location for the stdout contents. | [out][nullable]
stderr_buf | an optional location for the stderr contents. | [out][nullable]

#### Returns

`TRUE` if successful; otherwise `FALSE` and `error` is set.

### ide_subprocess_communicate_async ()

    void
    ide_subprocess_communicate_async (IdeSubprocess *self,
                                      GBytes *stdin_buf,
                                      GCancellable *cancellable,
                                      GAsyncReadyCallback callback,
                                      gpointer user_data);

Asynchronously communicates with the the child process.

There is no need to call `ide_subprocess_wait()` on the process if using this asynchronous operation as it will internally wait for the child to exit or be signaled.

Ensure you've set the proper flags to ensure that you can write to stdin or read from stderr/stdout as necessary.

#### Parameters

self | An IdeSubprocess |
stdin_buf | a GBytes to send to stdin or `NULL`. | [nullable]
cancellable | a GCancellable or `NULL`. | [nullable]
callback | A callback to complete the request |
user_data | user data for `callback` |

### ide_subprocess_communicate_finish ()

    gboolean
    ide_subprocess_communicate_finish (IdeSubprocess *self,
                                       GAsyncResult *result,
                                       GBytes **stdout_buf,
                                       GBytes **stderr_buf,
                                       GError **error);

Finishes a request to `ide_subprocess_communicate_async()`.

#### Parameters

self | An IdeSubprocess |
result | a GAsyncResult |
stdout_buf | A location for a Bytes. | [out][optional]
stderr_buf | A location for a Bytes. | [out][optional]
error | a location for a GError |

#### Returns

`TRUE` if successful; otherwise `FALSE` and `error` is set.

### ide_subprocess_communicate_utf8_async ()

    void
    ide_subprocess_communicate_utf8_async (IdeSubprocess *self,
                                           const gchar *stdin_buf,
                                           GCancellable *cancellable,
                                           GAsyncReadyCallback callback,
                                           gpointer user_data);

#### Parameters

stdin_buf | The data to send to stdin or `NULL`. | [nullable]

### ide_subprocess_communicate_utf8_finish ()

    gboolean
    ide_subprocess_communicate_utf8_finish
                                   (IdeSubprocess *self,
                                    GAsyncResult *result,
                                    gchar **stdout_buf,
                                    gchar **stderr_buf,
                                    GError **error);

#### Parameters

self | An IdeSubprocess |
result | a GAsyncResult |
stdout_buf | A location for the UTF-8 formatted output string or `NULL`. | [out][optional]
stderr_buf | A location for the UTF-8 formatted output string or `NULL`. | [out][optional]
error | A location for a GError, or `NULL` |

#### Returns

`TRUE` if successful; otherwise `FALSE` and `error` is set.

## Types and Values

### IDE_TYPE_SUBPROCESS

    #define IDE_TYPE_SUBPROCESS (ide_subprocess_get_type())

### struct IdeSubprocessInterface

    struct IdeSubprocessInterface {
      GTypeInterface parent_interface;

      const gchar   *(*get_identifier)          (IdeSubprocess        *self);
      GInputStream  *(*get_stdout_pipe)         (IdeSubprocess        *self);
      GInputStream  *(*get_stderr_pipe)         (IdeSubprocess        *self);
      GOutputStream *(*get_stdin_pipe)          (IdeSubprocess        *self);
      gboolean       (*wait)                    (IdeSubprocess        *self,
                                                 GCancellable         *cancellable,
                                                 GError              **error);
      void           (*wait_async)              (IdeSubprocess        *self,
                                                 GCancellable         *cancellable,
                                                 GAsyncReadyCallback   callback,
                                                 gpointer              user_data);
      gboolean       (*wait_finish)             (IdeSubprocess        *self,
                                                 GAsyncResult         *result,
                                                 GError              **error);
      gboolean       (*get_successful)          (IdeSubprocess        *self);
      gboolean       (*get_if_exited)           (IdeSubprocess        *self);
      gint           (*get_exit_status)         (IdeSubprocess        *self);
      gboolean       (*get_if_signaled)         (IdeSubprocess        *self);
      gint           (*get_term_sig)            (IdeSubprocess        *self);
      gint           (*get_status)              (IdeSubprocess        *self);
      void           (*send_signal)             (IdeSubprocess        *self,
                                                 gint                  signal_num);
      void           (*force_exit)              (IdeSubprocess        *self);
      gboolean       (*communicate)             (IdeSubprocess        *self,
                                                 GBytes               *stdin_buf,
                                                 GCancellable         *cancellable,
                                                 GBytes              **stdout_buf,
                                                 GBytes              **stderr_buf,
                                                 GError              **error);
      gboolean       (*communicate_utf8)        (IdeSubprocess        *self,
                                                 const gchar          *stdin_buf,
                                                 GCancellable         *cancellable,
                                                 gchar               **stdout_buf,
                                                 gchar               **stderr_buf,
                                                 GError              **error);
      void           (*communicate_async)       (IdeSubprocess        *self,
                                                 GBytes               *stdin_buf,
                                                 GCancellable         *cancellable,
                                                 GAsyncReadyCallback   callback,
                                                 gpointer              user_data);
      gboolean       (*communicate_finish)      (IdeSubprocess        *self,
                                                 GAsyncResult         *result,
                                                 GBytes              **stdout_buf,
                                                 GBytes              **stderr_buf,
                                                 GError              **error);
      void           (*communicate_utf8_async)  (IdeSubprocess        *self,
                                                 const gchar          *stdin_buf,
                                                 GCancellable         *cancellable,
                                                 GAsyncReadyCallback   callback,
                                                 gpointer              user_data);
      gboolean       (*communicate_utf8_finish) (IdeSubprocess        *self,
                                                 GAsyncResult         *result,
                                                 gchar               **stdout_buf,
                                                 gchar               **stderr_buf,
                                                 GError              **error);
    };

### IdeSubprocess

    typedef struct _IdeSubprocess IdeSubprocess;