Add G_SPAWN_DEFAULT to GSpawnFlags

This is convenient for language bindings, and also makes
invocations of g_spawn functions in C more readable.

https://bugzilla.gnome.org/show_bug.cgi?id=701318
This commit is contained in:
Robert Ancell 2013-05-31 11:07:55 +12:00 committed by Matthias Clasen
parent 8b3d779d1e
commit 3784927764
2 changed files with 3 additions and 1 deletions

View File

@ -144,6 +144,7 @@ typedef void (* GSpawnChildSetupFunc) (gpointer user_data);
/**
* GSpawnFlags:
* @G_SPAWN_DEFAULT: no flags, default behaviour
* @G_SPAWN_LEAVE_DESCRIPTORS_OPEN: the parent's open file descriptors will be
* inherited by the child; otherwise all descriptors except stdin/stdout/stderr
* will be closed before calling exec() in the child.
@ -171,6 +172,7 @@ typedef void (* GSpawnChildSetupFunc) (gpointer user_data);
*/
typedef enum
{
G_SPAWN_DEFAULT = 0,
G_SPAWN_LEAVE_DESCRIPTORS_OPEN = 1 << 0,
G_SPAWN_DO_NOT_REAP_CHILD = 1 << 1,
/* look for argv[0] in the path i.e. use execvp() */

View File

@ -72,7 +72,7 @@ test_spawn_sync_multithreaded_instance (gpointer data)
g_ptr_array_add (argv, arg);
g_ptr_array_add (argv, NULL);
g_spawn_sync (NULL, (char**)argv->pdata, NULL, 0, NULL, NULL, &stdout_str, NULL, &estatus, &error);
g_spawn_sync (NULL, (char**)argv->pdata, NULL, G_SPAWN_DEFAULT, NULL, NULL, &stdout_str, NULL, &estatus, &error);
g_assert_no_error (error);
g_assert_cmpstr (arg, ==, stdout_str);
g_free (arg);