diff options
Diffstat (limited to 'src/pty-unix.c')
-rw-r--r-- | src/pty-unix.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/pty-unix.c b/src/pty-unix.c index ba4ea34..376a92d 100644 --- a/src/pty-unix.c +++ b/src/pty-unix.c @@ -18,6 +18,8 @@ #include "term.h" #include "window-xlib.h" +extern char **environ; + static int runes_pty_input_cb(void *t); RunesPty *runes_pty_new() @@ -32,7 +34,7 @@ RunesPty *runes_pty_new() return pty; } -void runes_pty_spawn_subprocess(RunesTerm *t) +void runes_pty_spawn_subprocess(RunesTerm *t, char *envp[], char *cwd) { RunesPty *pty = t->pty; @@ -90,6 +92,14 @@ void runes_pty_spawn_subprocess(RunesTerm *t) unsetenv("LINES"); unsetenv("COLUMNS"); + if (cwd) { + chdir(cwd); + } + + if (envp) { + environ = envp; + } + if (strpbrk(cmd, " $")) { execlp("/bin/sh", "/bin/sh", "-c", cmd, (char *)NULL); } |