diff options
author | June McEnroe <june@causal.agency> | 2020-05-21 13:00:01 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-05-21 13:00:01 -0400 |
commit | 380132baef9edf7995429d4b31e6e112ef19b7b1 (patch) | |
tree | 7632c8ae28ce7574b7d7384cb4d88717049c3750 | |
parent | Automatically perform database migrations in litterbox (diff) | |
download | litterbox-380132baef9edf7995429d4b31e6e112ef19b7b1.tar.gz litterbox-380132baef9edf7995429d4b31e6e112ef19b7b1.zip |
Execute PAGER with the SHELL
Same as how git executes it. Allows flags to be set in PAGER.
-rw-r--r-- | scoop.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/scoop.c b/scoop.c index d95a971..4c4ee35 100644 --- a/scoop.c +++ b/scoop.c @@ -495,7 +495,9 @@ int main(int argc, char *argv[]) { } if (tty) { + const char *shell = getenv("SHELL"); const char *pager = getenv("PAGER"); + if (!shell) shell = "/bin/sh"; if (!pager) pager = "less"; setenv("LESS", "FRX", 0); @@ -510,8 +512,8 @@ int main(int argc, char *argv[]) { dup2(rw[0], STDIN_FILENO); close(rw[0]); close(rw[1]); - execlp(pager, pager, NULL); - err(EX_CONFIG, "%s", pager); + execl(shell, shell, "-c", pager, NULL); + err(EX_CONFIG, "%s", shell); } dup2(rw[1], STDOUT_FILENO); |