[glib/wip/gsubprocess: 6/6] GSubprocess: [rebase] Add option to use envp



commit e213e4e211d9d44f7b5ffff52f45d1e7511a05f7
Author: Colin Walters <walters verbum org>
Date:   Thu May 24 10:53:24 2012 -0400

    GSubprocess: [rebase] Add option to use envp

 docs/reference/gio/gio-sections.txt |    1 +
 gio/gio.symbols                     |    1 +
 gio/gsubprocess.c                   |   28 ++++++++++++++++++++++++++++
 gio/gsubprocess.h                   |    4 ++++
 4 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gio/gio-sections.txt b/docs/reference/gio/gio-sections.txt
index bb13fdd..dc2a53e 100644
--- a/docs/reference/gio/gio-sections.txt
+++ b/docs/reference/gio/gio-sections.txt
@@ -3915,6 +3915,7 @@ g_subprocess_set_environment
 g_subprocess_set_io_priority
 g_subprocess_set_leave_descriptors_open
 g_subprocess_set_use_search_path
+g_subprocess_set_use_search_path_from_envp
 g_subprocess_set_standard_error_to_devnull
 g_subprocess_set_standard_error_to_stdout
 g_subprocess_set_standard_error_unix_fd
diff --git a/gio/gio.symbols b/gio/gio.symbols
index ba8b92c..4e49b7f 100644
--- a/gio/gio.symbols
+++ b/gio/gio.symbols
@@ -1101,6 +1101,7 @@ g_subprocess_setenv
 g_subprocess_set_io_priority
 g_subprocess_set_leave_descriptors_open
 g_subprocess_set_use_search_path
+g_subprocess_set_use_search_path_from_envp
 g_subprocess_set_standard_error_to_devnull
 g_subprocess_set_standard_error_to_stdout
 #ifdef G_OS_UNIX
diff --git a/gio/gsubprocess.c b/gio/gsubprocess.c
index d610e71..f096675 100644
--- a/gio/gsubprocess.c
+++ b/gio/gsubprocess.c
@@ -71,6 +71,7 @@ struct _GSubprocess
 
   guint detached : 1;
   guint search_path : 1;
+  guint search_path_from_envp : 1;
   guint leave_descriptors_open : 1;
   guint stdin_to_devnull : 1;
   guint stdout_to_devnull : 1;
@@ -504,6 +505,31 @@ g_subprocess_set_use_search_path (GSubprocess     *self,
 }
 
 /**
+ * g_subprocess_set_use_search_path_from_envp:
+ * @self: a #GSubprocess
+ * @do_search_path_from_envp: %TRUE if the PATH environment variable should be searched
+ *
+ * This option corresponds to the %G_SPAWN_SEARCH_PATH_FROM_ENVP flag;
+ * the uses for this are fairly specialized, such as when you are
+ * proxying execution from another context.
+ *
+ * It is invalid to call this function after g_subprocess_start() has
+ * been called.
+ *
+ * Since: 2.34
+ */
+void
+g_subprocess_set_use_search_path_from_envp (GSubprocess     *self,
+					    gboolean         do_search_path_from_envp)
+{
+  g_return_if_fail (G_IS_SUBPROCESS (self));
+  g_return_if_fail (self->state == G_SUBPROCESS_STATE_BUILDING);
+  
+  self->search_path_from_envp = do_search_path_from_envp;
+
+}
+
+/**
  * g_subprocess_set_leave_descriptors_open:
  * @self: a #GSubprocess
  * @do_leave_descriptors_open: %TRUE if file descriptors should be left open
@@ -1411,6 +1437,8 @@ g_subprocess_start_with_pipes (GSubprocess       *self,
     spawn_flags |= G_SPAWN_LEAVE_DESCRIPTORS_OPEN;
   if (self->search_path)
     spawn_flags |= G_SPAWN_SEARCH_PATH;
+  if (self->search_path_from_envp)
+    spawn_flags |= G_SPAWN_SEARCH_PATH_FROM_ENVP;
   if (!self->detached)
     spawn_flags |= G_SPAWN_DO_NOT_REAP_CHILD;
 
diff --git a/gio/gsubprocess.h b/gio/gsubprocess.h
index e8d1cd4..cbb5eab 100644
--- a/gio/gsubprocess.h
+++ b/gio/gsubprocess.h
@@ -81,6 +81,10 @@ void             g_subprocess_set_use_search_path (GSubprocess     *self,
 						   gboolean         do_search_path);
 
 GLIB_AVAILABLE_IN_2_34
+void             g_subprocess_set_use_search_path_from_envp (GSubprocess     *self,
+							     gboolean         do_search_path);
+
+GLIB_AVAILABLE_IN_2_34
 void             g_subprocess_set_leave_descriptors_open (GSubprocess     *self,
 							  gboolean         do_leave_descriptors_open);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]