[glib: 2/4] GSubprocess test: Add PATH to the envtable that is passed to child
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 2/4] GSubprocess test: Add PATH to the envtable that is passed to child
- Date: Wed, 13 Feb 2019 10:37:43 +0000 (UTC)
commit 4bc1aa23a9947932f7a71b900ce470e42d062314
Author: Руслан Ижбулатов <lrn1986 gmail com>
Date: Mon Feb 11 23:53:38 2019 +0000
GSubprocess test: Add PATH to the envtable that is passed to child
envp in spawn() functions is the *whole* environment table
for the child process. Including PATH. Thus, unless PATH is explicitly
put into that table, the process will be spawned without PATH.
Since on Windows binaries are found via PATH instead of LD_LIBRARY_PATH
or whatever, almost no program (unless installed in WINDIR, maybe)
can run without a PATH. Certainly not test programs - meson
adds bld subdirs to the PATH to make sure that test programs
use uninstalled glib at runtime.
So make sure that PATH is passed along.
gio/tests/gsubprocess.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/gio/tests/gsubprocess.c b/gio/tests/gsubprocess.c
index c2a054414..158366444 100644
--- a/gio/tests/gsubprocess.c
+++ b/gio/tests/gsubprocess.c
@@ -1363,9 +1363,10 @@ test_env (void)
GPtrArray *args;
GInputStream *stdout_stream;
gchar *result;
- gchar *envp[] = { "ONE=1", "TWO=1", "THREE=3", "FOUR=1", NULL };
+ gchar *envp[] = { NULL, "ONE=1", "TWO=1", "THREE=3", "FOUR=1", NULL };
gchar **split;
+ envp[0] = g_strdup_printf ("PATH=%s", g_getenv ("PATH"));
args = get_test_subprocess_args ("env", NULL);
launcher = g_subprocess_launcher_new (G_SUBPROCESS_FLAGS_NONE);
g_subprocess_launcher_set_flags (launcher, G_SUBPROCESS_FLAGS_STDOUT_PIPE);
@@ -1379,6 +1380,7 @@ test_env (void)
proc = g_subprocess_launcher_spawn (launcher, error, args->pdata[0], "env", NULL);
g_ptr_array_free (args, TRUE);
g_assert_no_error (local_error);
+ g_free (envp[0]);
stdout_stream = g_subprocess_get_stdout_pipe (proc);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]