Ya know, you keep giving me these same day answers, and I'm going to start expecting them from you consistently ;-)
Seriously though, I appreciate it. I almost found the "best" way of doing it. After researching your suggestions, here is the updated code snippet:
Code:
MyWidgets *widgets;
const gchar *host;
gchar *command;
gint argc;
gchar **argv = NULL;
GPid pid;
GError *error = NULL;
gulong flags = G_SPAWN_SEARCH_PATH|G_SPAWN_STDOUT_TO_DEV_NULL|G_SPAWN_STDERR_TO_DEV_NULL;
const gchar *sshport;
const gchar *sshuser;
const gchar *sshoptions;
sshport = gtk_entry_get_text (GTK_ENTRY (widgets->ssh_port_sbtn));
sshuser = gtk_entry_get_text (GTK_ENTRY (widgets->ssh_user_entry));
sshoptions = gtk_entry_get_text (GTK_ENTRY (widgets->ssh_options_entry));
command = g_strdup_printf ("gnome-terminal --geometry 110x25 -e \"ssh -p %s %s %s@%s\"",
sshport,
sshoptions,
sshuser,
host);
g_shell_parse_argv(command,
&argc,
&argv,
NULL);
g_spawn_async_with_pipes( appdir, // const gchar *working_directory
argv, // gchar **argv
NULL, // gchar **envp
flags, // GSpawnFlags flags
NULL, // GSpawnChildSetupFunc child_setup
NULL, // gpointer user_data
&pid, // GPid *child_pid
NULL, // gint *standard_input
NULL, // gint *standard_output
NULL, // gint *standard_error
&error); // GError **error
g_strfreev(argv);
g_free(command);
This is launching the command as expected. Appreciate it!
However, the original problem that started me down the
g_spawn_async_with_pipes path is back. If I have a pipe "|" in the command, it doesn't launch. Meaning, if I were to replace that specified command with something like this:
Code:
command = g_strdup_printf ("echo %s | vncviewer -autopass -quality %s -compresslevel %s %s::%s",
vncpasswd,
vncquality,
vnccompresslevel,
host,
vncport);
...this doesn't work. If I remove the pipe (and thus alter the command a little), then it does. Looks like I need to look into
g_spawn_async_with_pipes a little more, because I'm obviously missing something simple.
Thanks,
-Lup