Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/eglib
diff options
context:
space:
mode:
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>2006-10-07 23:10:43 +0400
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>2006-10-07 23:10:43 +0400
commitf2b45610dac97f836d68bf52ff3a50f940853f66 (patch)
tree007225c351109a30afef4c087cfb721df13892f4 /eglib
parentc9274f2710476b79a93d036c113a3c15ae592115 (diff)
2006-10-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* test/spawn.c: add search path flag when running ls. * src/gspawn.c: g_spawn_command_line_sync searches the program in the PATH if it's not an absolute path. svn path=/trunk/mono/; revision=66390
Diffstat (limited to 'eglib')
-rw-r--r--eglib/ChangeLog6
-rw-r--r--eglib/src/gspawn.c11
-rw-r--r--eglib/test/spawn.c5
3 files changed, 19 insertions, 3 deletions
diff --git a/eglib/ChangeLog b/eglib/ChangeLog
index eaf34d70077..2fb45f0aef5 100644
--- a/eglib/ChangeLog
+++ b/eglib/ChangeLog
@@ -1,5 +1,11 @@
2006-10-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+ * test/spawn.c: add search path flag when running ls.
+ * src/gspawn.c: g_spawn_command_line_sync searches the program in the
+ PATH if it's not an absolute path.
+
+2006-10-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
* test/string-util.c:
* src/glib.h: implement g_ascii_xdigit_value and tests.
diff --git a/eglib/src/gspawn.c b/eglib/src/gspawn.c
index 65a41de1127..d73e2864dea 100644
--- a/eglib/src/gspawn.c
+++ b/eglib/src/gspawn.c
@@ -185,6 +185,17 @@ g_spawn_command_line_sync (const gchar *command_line,
for (i = getdtablesize () - 1; i >= 3; i--)
close (i);
+ /* G_SPAWN_SEARCH_PATH is always enabled for g_spawn_command_line_sync */
+ if (!g_path_is_absolute (argv [0])) {
+ gchar *arg0;
+
+ arg0 = g_find_program_in_path (argv [0]);
+ if (arg0 == NULL) {
+ exit (1);
+ }
+ //g_free (argv [0]);
+ argv [0] = arg0;
+ }
execv (argv [0], argv);
exit (1); /* TODO: What now? */
}
diff --git a/eglib/test/spawn.c b/eglib/test/spawn.c
index 36cd5740997..cfeeabbd222 100644
--- a/eglib/test/spawn.c
+++ b/eglib/test/spawn.c
@@ -9,7 +9,7 @@ test_spawn_sync ()
{
gchar *out;
gchar *err;
- gint status;
+ gint status = -1;
GError *error = NULL;
if (!g_spawn_command_line_sync ("ls", &out, &err, &status, &error))
@@ -49,7 +49,7 @@ g_spawn_async_with_pipes (const gchar *working_directory,
memset (argv, 0, 15 * sizeof (char *));
argv [0] = "ls";
- if (!g_spawn_async_with_pipes (NULL, argv, NULL, 0, NULL, NULL, &child_pid, NULL, &stdout_fd, NULL, NULL))
+ if (!g_spawn_async_with_pipes (NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, &child_pid, NULL, &stdout_fd, NULL, NULL))
return FAILED ("1 Failed to run ls");
if (child_pid == 0)
return FAILED ("2 child pid not returned");
@@ -58,7 +58,6 @@ g_spawn_async_with_pipes (const gchar *working_directory,
while (read (stdout_fd, buffer, 512) > 0);
close (stdout_fd);
- printf ("Child pid: %d\n", child_pid);
return OK;
}