### Constructor

# Gio Subprocess new

since: 2.40

#### Declaration

    GSubprocess*
    g_subprocess_new (
      GSubprocessFlags flags,
      GError** error,
      const gchar* argv0,
      ...
    )

#### Description

Create a new process with the given flags and varargs argument list. By default, matching the `g_spawn_async()` defaults, the child’s stdin will be set to the system null device, and stdout/stderr will be inherited from the parent. You can use `flags` to control this behavior.

The argument list must be terminated with `NULL`.

Available since: 2.40

This method is not directly available to language bindings.

#### Parameters

`flags`

  Type: `GSubprocessFlags`

  Flags that define the behaviour of the subprocess.

`error`

  Type: `GError`

  Return location for an error, or `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the function.

`argv0`

  Type: `const gchar*`

  First commandline argument to pass to the subprocess.

  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

`...`

  Type: ``

  More commandline arguments, followed by `NULL`.

#### Return value

Type: `GSubprocess`

A newly created `GSubprocess`, or `NULL` on error (and `error` will be set)

The caller of the function takes ownership of the data, and is responsible for freeing it.