[geany/geany] 942d4c: Start bash as a login shell in VTE under OS X

Jiří Techet git-noreply at xxxxx
Tue May 26 21:36:06 UTC 2015


Branch:      refs/heads/master
Author:      Jiří Techet <techet at gmail.com>
Committer:   Jiří Techet <techet at gmail.com>
Date:        Mon, 06 Apr 2015 17:19:55 UTC
Commit:      942d4c6b7fbc10eaf984b4c6d51fcf4efd56f2fa
             https://github.com/geany/geany/commit/942d4c6b7fbc10eaf984b4c6d51fcf4efd56f2fa

Log Message:
-----------
Start bash as a login shell in VTE under OS X

Graphical applications on OS X are started using launchd and don't inherit
shell's environment variables so we don't get the PS1 value. Do the same
as the OS X terminal emulator which runs the shell as a login shell (and yes,
on OS X .bash_profile is read for shells started in the terminal application
instead of .bashrc).


Modified Paths:
--------------
    src/keyfile.c

Modified: src/keyfile.c
7 lines changed, 7 insertions(+), 0 deletions(-)
===================================================================
@@ -861,6 +861,13 @@ static void load_dialog_prefs(GKeyFile *config)
 		struct passwd *pw = getpwuid(getuid());
 		const gchar *shell = (pw != NULL) ? pw->pw_shell : "/bin/sh";
 
+#ifdef __APPLE__
+		/* Geany is started using launchd on OS X and we don't get any environment variables
+		 * so PS1 isn't defined. Start as a login shell to read the corresponding config files. */
+		if (strcmp(shell, "/bin/bash") == 0)
+			shell = "/bin/bash -l";
+#endif
+
 		vc = g_new0(VteConfig, 1);
 		vte_info.dir = utils_get_setting_string(config, "VTE", "last_dir", NULL);
 		if ((vte_info.dir == NULL || utils_str_equal(vte_info.dir, "")) && pw != NULL)



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list