Commit f964d78b authored by Zander Brown's avatar Zander Brown Committed by Zander Brown

handle -e correctly

parent 4b4e7baf
......@@ -226,7 +226,7 @@ fp_vte_pty_spawn_async (VtePty *pty,
working_directory,
(gchar **)real_argv->pdata,
NULL,
0,
G_SPAWN_SEARCH_PATH | G_SPAWN_SEARCH_PATH_FROM_ENVP,
NULL, NULL, NULL,
-1,
cancellable,
......
......@@ -209,30 +209,36 @@ static void
kgx_window_constructed (GObject *object)
{
KgxWindow *self = KGX_WINDOW (object);
gchar *shell[2] = {NULL, NULL};
const char *initial = NULL;
g_autoptr (VtePty) pty = NULL;
g_autoptr (GError) error = NULL;
g_auto (GStrv) shell = NULL;
g_auto (GStrv) env = NULL;
g_autofree char *command = NULL;
pty = vte_pty_new_sync (fp_vte_pty_default_flags (), NULL, &error);
if (G_UNLIKELY (self->command != NULL)) {
// dup the string so we can free shell[0] later to handle the
// dup the string so we can free command later to handle the
// (more likely) fp_vte_guess_shell case
shell[0] = g_strdup (self->command);
command = g_strdup (self->command);
} else {
shell[0] = fp_vte_guess_shell (NULL, &error);
command = fp_vte_guess_shell (NULL, &error);
if (error) {
g_warning ("flatterm: %s", error->message);
}
}
if (shell[0] == NULL) {
shell[0] = g_strdup ("/bin/sh");
if (command == NULL) {
command = g_strdup ("/bin/sh");
g_warning ("Defaulting to %s", shell[0]);
}
g_shell_parse_argv (command, NULL, &shell, &error);
if (error) {
g_warning ("Can't handle %s: %s", command, error->message);
}
if (self->working_dir) {
initial = self->working_dir;
} else {
......@@ -253,8 +259,6 @@ kgx_window_constructed (GObject *object)
(GAsyncReadyCallback) spawned,
self);
g_free (shell[0]);
G_OBJECT_CLASS (kgx_window_parent_class)->constructed (object);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment