[gnome-builder] terminal: use proper argv for command execution
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] terminal: use proper argv for command execution
- Date: Fri, 16 Sep 2016 19:45:12 +0000 (UTC)
commit e930bb92513f3c1952776cbf4d8892d86874111f
Author: Christian Hergert <chergert redhat com>
Date: Fri Sep 16 12:43:17 2016 -0700
terminal: use proper argv for command execution
We need the arguments split, for which we were not doing. Which meant the
host was looking for a fully qualified path instead of argv0.
plugins/terminal/gb-terminal-view.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/plugins/terminal/gb-terminal-view.c b/plugins/terminal/gb-terminal-view.c
index 7ecea16..feedebb 100644
--- a/plugins/terminal/gb-terminal-view.c
+++ b/plugins/terminal/gb-terminal-view.c
@@ -81,6 +81,7 @@ gb_terminal_view_discover_shell (GCancellable *cancellable,
g_autoptr(IdeSubprocess) subprocess = NULL;
g_autofree gchar *command = NULL;
g_autofree gchar *stdout_buf = NULL;
+ g_auto(GStrv) argv = NULL;
g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
@@ -90,13 +91,16 @@ gb_terminal_view_discover_shell (GCancellable *cancellable,
command = g_strdup_printf ("sh -c 'cat /etc/passwd | grep ^%s: | cut -f 7 -d :'",
g_get_user_name ());
+ if (!g_shell_parse_argv (command, NULL, &argv, error))
+ return NULL;
+
launcher = ide_subprocess_launcher_new (G_SUBPROCESS_FLAGS_STDOUT_PIPE |
G_SUBPROCESS_FLAGS_STDIN_PIPE |
G_SUBPROCESS_FLAGS_STDERR_PIPE);
ide_subprocess_launcher_set_run_on_host (launcher, TRUE);
ide_subprocess_launcher_set_clear_env (launcher, FALSE);
ide_subprocess_launcher_set_cwd (launcher, g_get_home_dir ());
- ide_subprocess_launcher_push_argv (launcher, command);
+ ide_subprocess_launcher_push_args (launcher, (const gchar * const *)argv);
subprocess = ide_subprocess_launcher_spawn_sync (launcher, cancellable, error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]