From 380132baef9edf7995429d4b31e6e112ef19b7b1 Mon Sep 17 00:00:00 2001
From: "C. McEnroe" <june@causal.agency>
Date: Thu, 21 May 2020 13:00:01 -0400
Subject: Execute PAGER with the SHELL

Same as how git executes it. Allows flags to be set in PAGER.
---
 scoop.c | 6 ++++--
 1 file 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);
-- 
cgit 1.4.1