### Function

# GLib spawn_command_line_sync

#### Declaration [src]

    gboolean
    g_spawn_command_line_sync (
      const gchar* command_line,
      gchar** standard_output,
      gchar** standard_error,
      gint* wait_status,
      GError** error
    )

#### Description [src]

A simple version of `g_spawn_sync()` with little-used parameters removed, taking a command line instead of an argument vector.

See `g_spawn_sync()` for full details.

The `command_line` argument will be parsed by g_shell_parse_argv().

Unlike g_spawn_sync(), the `G_SPAWN_SEARCH_PATH` flag is enabled. Note that `G_SPAWN_SEARCH_PATH` can have security implications, so consider using `g_spawn_sync()` directly if appropriate.

Possible errors are those from `g_spawn_sync()` and those from g_shell_parse_argv().

If `wait_status` is non-`NULL`, the platform-specific status of the child is stored there; see the documentation of `g_spawn_check_wait_status()` for how to use and interpret this. On Unix platforms, note that it is usually not equal to the integer passed to `exit()` or returned from `main()`.

On Windows, please note the implications of `g_shell_parse_argv()` parsing `command_line`. Parsing is done according to Unix shell rules, not Windows command interpreter rules. Space is a separator, and backslashes are special. Thus you cannot simply pass a `command_line` containing canonical Windows paths, like “c:\program files\app\app.exe”, as the backslashes will be eaten, and the space will act as a separator. You need to enclose such paths with single quotes, like “‘c:\program files\app\app.exe’ ‘e:\folder\argument.txt’”.

#### Parameters

`command_line`

  Type: `const gchar*`

  A command line.

  The data is owned by the caller of the function.
  The value is a platform-native string, using the preferred OS encoding on Unix and UTF-8 on Windows.

`standard_output`

  Type: An array of `guint8`

  Return location for child output.

  The argument will be set by the function.
  The argument can be `NULL`.
  The array must be `NULL`-terminated.
  The caller of the function takes ownership of the returned data, and is responsible for freeing it.

`standard_error`

  Type: An array of `guint8`

  Return location for child errors.

  The argument will be set by the function.
  The argument can be `NULL`.
  The array must be `NULL`-terminated.
  The caller of the function takes ownership of the returned data, and is responsible for freeing it.

`wait_status`

  Type: `gint*`

  Return location for child wait status, as returned by waitpid().

  The argument will be set by the function.
  The argument can be `NULL`.

`error`

  Type: `GError **`

  The return location for a recoverable error.

  The argument can be `NULL`.
  If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`.
  The argument will be left initialized to `NULL` by the function if there are no errors.
  In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it.

#### Return value

Type: `gboolean`

`TRUE` on success, `FALSE` if an error was set.