diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-04-20 22:17:09 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-04-20 22:17:09 -0400 |
commit | 996a1e445f3dc477ca49f4292b5d9a58a1096726 (patch) | |
tree | a6f934cde6cb2489458be5781f6db6f50cb39745 /pty-unix.c | |
parent | f269a4a324396423d97da783ad372cdbb275eb65 (diff) | |
download | runes-996a1e445f3dc477ca49f4292b5d9a58a1096726.tar.gz runes-996a1e445f3dc477ca49f4292b5d9a58a1096726.zip |
allow customizing the command to be run
Diffstat (limited to 'pty-unix.c')
-rw-r--r-- | pty-unix.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -24,7 +24,7 @@ void runes_pty_backend_spawn_subprocess(RunesTerm *t) pty->slave = -1; } else { - char *shell; + char *cmd; setsid(); ioctl(pty->slave, TIOCSCTTY, NULL); @@ -37,9 +37,12 @@ void runes_pty_backend_spawn_subprocess(RunesTerm *t) close(pty->slave); - shell = getenv("SHELL"); - if (!shell) { - shell = "/bin/sh"; + cmd = t->cmd; + if (!cmd) { + cmd = getenv("SHELL"); + } + if (!cmd) { + cmd = "/bin/sh"; } /* XXX should use a different TERM value eventually, but for right now @@ -48,7 +51,7 @@ void runes_pty_backend_spawn_subprocess(RunesTerm *t) unsetenv("LINES"); unsetenv("COLUMNS"); - execl(shell, shell, (char *)NULL); + execl(cmd, cmd, (char *)NULL); } } |