Git development
 help / color / mirror / Atom feed
* [RFC/PATCH] pager: do not fork a pager if environment variable PAGER is set to NONE
@ 2006-04-15 13:16 Johannes Schindelin
  2006-04-15 20:50 ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Johannes Schindelin @ 2006-04-15 13:16 UTC (permalink / raw)
  To: git


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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-04-16  2:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-15 13:16 [RFC/PATCH] pager: do not fork a pager if environment variable PAGER is set to NONE Johannes Schindelin
2006-04-15 20:50 ` Junio C Hamano
2006-04-16  2:01   ` Johannes Schindelin
2006-04-16  2:20     ` Junio C Hamano
2006-04-16  2:44       ` Johannes Schindelin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox