summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b6f5da1)
raw | patch | inline | side by side (parent: b6f5da1)
author | Linus Torvalds <torvalds@linux-foundation.org> | |
Wed, 24 Jan 2007 19:21:10 +0000 (11:21 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Mon, 5 Feb 2007 23:42:36 +0000 (15:42 -0800) |
If you resize the terminal while less is waiting for input, less
will exit entirely without even showing the output. This is very
noticeable if you do something like "git diff" on a big and
cold-cache tree and git takes a few seconds to think, and then
you resize the window while it's preparing. Boom. No output AT
ALL.
The way to reproduce the problem is to do some pager operation
that takes a while in git, and resizing the window while git is
thinking about the output. Try
git diff --stat v2.6.12..
in the kernel tree to do something where it takes a while for git to start
outputting information.
Signed-off-by: Junio C Hamano <junkio@cox.net>
will exit entirely without even showing the output. This is very
noticeable if you do something like "git diff" on a big and
cold-cache tree and git takes a few seconds to think, and then
you resize the window while it's preparing. Boom. No output AT
ALL.
The way to reproduce the problem is to do some pager operation
that takes a while in git, and resizing the window while git is
thinking about the output. Try
git diff --stat v2.6.12..
in the kernel tree to do something where it takes a while for git to start
outputting information.
Signed-off-by: Junio C Hamano <junkio@cox.net>
pager.c | patch | blob | history |
index 4587fbbdb51e50c1e3e6e4c3476cdccd4ac59cee..5f280ab52720772905cacbcba522ecc9c81bb529 100644 (file)
--- a/pager.c
+++ b/pager.c
#include "cache.h"
+#include <sys/select.h>
+
/*
* This is split up from the rest of git so that we might do
* something different on Windows, for example.
static void run_pager(const char *pager)
{
+ /*
+ * Work around bug in "less" by not starting it until we
+ * have real input
+ */
+ fd_set in;
+
+ FD_ZERO(&in);
+ FD_SET(0, &in);
+ select(1, &in, NULL, &in, NULL);
+
execlp(pager, pager, NULL);
execl("/bin/sh", "sh", "-c", pager, NULL);
}