From 9e9bb0764d81c34c837748f9fade0cbb7aba582f Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sat, 4 Jun 2016 03:18:10 -0400 Subject: don't overwrite our env changes with a passed in env our changes always need to happen, on top of whatever env was passed in --- src/pty-unix.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/pty-unix.c b/src/pty-unix.c index 376a92d..8eed477 100644 --- a/src/pty-unix.c +++ b/src/pty-unix.c @@ -65,12 +65,12 @@ void runes_pty_spawn_subprocess(RunesTerm *t, char *envp[], char *cwd) close(pty->slave); - cmd = t->config->cmd; - if (!cmd) { - cmd = getenv("SHELL"); + if (cwd) { + chdir(cwd); } - if (!cmd) { - cmd = "/bin/sh"; + + if (envp) { + environ = envp; } /* XXX should use a different TERM value eventually, but for right now @@ -92,12 +92,12 @@ void runes_pty_spawn_subprocess(RunesTerm *t, char *envp[], char *cwd) unsetenv("LINES"); unsetenv("COLUMNS"); - if (cwd) { - chdir(cwd); + cmd = t->config->cmd; + if (!cmd) { + cmd = getenv("SHELL"); } - - if (envp) { - environ = envp; + if (!cmd) { + cmd = "/bin/sh"; } if (strpbrk(cmd, " $")) { -- cgit v1.2.3-54-g00ecf