[gnome-terminal] client: Set the PWD correctly in the environment



commit 3e57ba80b0e1f30f1fa060201abde6a64a8f656e
Author: Christian Persch <chpe gnome org>
Date:   Mon Jun 4 22:44:34 2012 +0200

    client: Set the PWD correctly in the environment
    
    Commit 760fbbd9340dac63b29436a3de411053456c8d2d added the code at the wrong place,
    move it to the right one.

 src/terminal-client-utils.c |    1 +
 src/terminal-screen.c       |   12 ++++++------
 2 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/src/terminal-client-utils.c b/src/terminal-client-utils.c
index de497c3..9a664e9 100644
--- a/src/terminal-client-utils.c
+++ b/src/terminal-client-utils.c
@@ -105,6 +105,7 @@ terminal_client_append_exec_options (GVariantBuilder *builder,
   envv = g_environ_unsetenv (envv, "DESKTOP_STARTUP_ID");
   envv = g_environ_unsetenv (envv, "GIO_LAUNCHED_DESKTOP_FILE_PID");
   envv = g_environ_unsetenv (envv, "GIO_LAUNCHED_DESKTOP_FILE");
+  envv = g_environ_unsetenv (envv, "PWD");
 
   g_variant_builder_add (builder, "{sv}",
                          "environ",
diff --git a/src/terminal-screen.c b/src/terminal-screen.c
index 83dbc03..befd075 100644
--- a/src/terminal-screen.c
+++ b/src/terminal-screen.c
@@ -1329,6 +1329,12 @@ get_child_environment (TerminalScreen *screen,
     }
 #endif
 
+  /* We need to put the working directory also in PWD, so that
+   * e.g. bash starts in the right directory if @cwd is a symlink.
+   * See bug #502146.
+   */
+  g_hash_table_replace (env_table, g_strdup ("PWD"), g_strdup (cwd));
+
   terminal_util_add_proxy_env (env_table);
 
   retval = g_ptr_array_sized_new (g_hash_table_size (env_table));
@@ -1339,12 +1345,6 @@ get_child_environment (TerminalScreen *screen,
 
   *shell = g_strdup (g_hash_table_lookup (env_table, "SHELL"));
 
-  /* We need to put the working directory also in PWD, so that
-   * e.g. bash starts in the right directory if @cwd is a symlink.
-   * See bug #502146.
-   */
-  g_hash_table_replace (env_table, g_strdup ("PWD"), g_strdup (cwd));
-
   g_hash_table_destroy (env_table);
   return (char **) g_ptr_array_free (retval, FALSE);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]