Add G_SPAWN_DEFAULT to GSpawnFlags
authorRobert Ancell <robert.ancell@canonical.com>
Thu, 30 May 2013 23:07:55 +0000 (11:07 +1200)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 17 Aug 2013 17:02:25 +0000 (13:02 -0400)
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

glib/gspawn.h
glib/tests/spawn-multithreaded.c

index 24bd521..5b5853a 100644 (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() */
index 781ae4a..99f99b4 100644 (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);