aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--st.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/st.c b/st.c
index 4d04416..d43c30c 100644
--- a/st.c
+++ b/st.c
@@ -545,11 +545,15 @@ die(const char *errstr, ...) {
545 545
546void 546void
547execsh(void) { 547execsh(void) {
548 char *args[] = {getenv("SHELL"), "-i", NULL}; 548 char **args;
549 char *envshell = getenv("SHELL");
550 DEFAULT(envshell, "sh");
551
549 if(opt_cmd) 552 if(opt_cmd)
550 args[0] = opt_cmd, args[1] = NULL; 553 args = (char*[]){"sh", "-c", opt_cmd, NULL};
551 else 554 else
552 DEFAULT(args[0], SHELL); 555 args = (char*[]){envshell, "-i", NULL};
556
553 putenv("TERM="TNAME); 557 putenv("TERM="TNAME);
554 execvp(args[0], args); 558 execvp(args[0], args);
555} 559}