git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[RFC/PATCH] pager: do not fork a pager if environment variable PAGER is set to NONE

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Apr 15, 2006, 13:16 UTC
Message-ID
<Pine.LNX.4.63.0604151516150.6563@wbgn013.biozentrum.uni-wuerzburg.de>
This helps debugging tremendously.
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
 pager.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
a91a9371e117555a03cfe7d24515787fb13005b6
diff --git a/pager.c b/pager.c
index 1364e15..1136adf 100644
--- a/pager.c
+++ b/pager.c
@@ -5,9 +5,8 @@ #include "cache.h"
  * something different on Windows, for example.
  */
 
-static void run_pager(void)
+static void run_pager(const char *prog)
 {
-	const char *prog = getenv("PAGER");
 	if (!prog)
 		prog = "less";
 	setenv("LESS", "-S", 0);
@@ -16,10 +15,11 @@ static void run_pager(void)
 
 void setup_pager(void)
 {
+	const char *prog = getenv("PAGER");
 	pid_t pid;
 	int fd[2];
 
-	if (!isatty(1))
+	if (!isatty(1) || (prog != NULL && !strcmp(prog, "NONE")))
 		return;
 	if (pipe(fd) < 0)
 		return;
@@ -43,6 +43,6 @@ void setup_pager(void)
 	close(fd[0]);
 	close(fd[1]);
 
-	run_pager();
+	run_pager(prog);
 	exit(255);
 }
-- 
1.3.0.rc4.g667c
Next: Junio C Hamano
Message 1 of 5 in “pager: do not fork a pager if environment variable PAGER is set to NONE”
  1. pager: do not fork a pager if environment variable PAGER is set to NONEJohannes Schindelin, Apr 15, 2006
  2. Junio C HamanoApr 15, 2006
  3. Johannes SchindelinApr 16, 2006
  4. Junio C HamanoApr 16, 2006
  5. Johannes SchindelinApr 16, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.