### Method

# Xdp Portal spawn

#### Declaration [src]

    void
    xdp_portal_spawn (
      XdpPortal* portal,
      const char* cwd,
      const char* const* argv,
      int* fds,
      int* map_to,
      int n_fds,
      const char* const* env,
      XdpSpawnFlags flags,
      const char* const* sandbox_expose,
      const char* const* sandbox_expose_ro,
      GCancellable* cancellable,
      GAsyncReadyCallback callback,
      gpointer data
    )

#### Description [src]

Creates a new copy of the applications sandbox, and runs a process in, with the given arguments.

The learn when the spawned process exits, connect to the `XdpPortal::spawn-exited` signal.

This method completes asynchronously. Use `xdp_portal_spawn_finish()` inside the `GAsyncReadyCallback` to obtain the result of the operation.

#### Parameters

`cwd`

  Type: `const char*`

  The cwd for the new process.

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

`argv`

  Type: An array of `char*`

  The argv for the new process.

  The array must be `NULL`-terminated.
  The data is owned by the caller of the method.
  Each element is a NUL terminated UTF-8 string.

`fds`

  Type: An array of `int`

  An array of open fds to pass to the new process, or `NULL`.

  The argument can be `NULL`.
  The length of the array is specified in the `n_fds` argument.
  The data is owned by the caller of the method.

`map_to`

  Type: An array of `int`

  An array of integers to map the `fds` to, or `NULL`. Must be the same length as `fds`.

  The argument can be `NULL`.
  The length of the array is specified in the `n_fds` argument.
  The data is owned by the caller of the method.

`n_fds`

  Type: `int`

  The length of `fds` and `map_to` arrays.

`env`

  Type: An array of `char*`

  An array of KEY=VALUE environment settings, or `NULL`.

  The argument can be `NULL`.
  The array must be `NULL`-terminated.
  The data is owned by the caller of the method.
  Each element is a NUL terminated UTF-8 string.

`flags`

  Type: `XdpSpawnFlags`

  Flags influencing the spawn operation.

`sandbox_expose`

  Type: An array of `char*`

  Paths to expose rw in the new sandbox, or `NULL`.

  The argument can be `NULL`.
  The array must be `NULL`-terminated.
  The data is owned by the caller of the method.
  Each element is a NUL terminated UTF-8 string.

`sandbox_expose_ro`

  Type: An array of `char*`

  Paths to expose ro in the new sandbox, or `NULL`.

  The argument can be `NULL`.
  The array must be `NULL`-terminated.
  The data is owned by the caller of the method.
  Each element is a NUL terminated UTF-8 string.

`cancellable`

  Type: `GCancellable`

  Optional `GCancellable`.

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

`callback`

  Type: `GAsyncReadyCallback`

  A callback to call when the request is done.

  The argument can be `NULL`.

`data`

  Type: `gpointer`

  Data to pass to `callback`.

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