Thread (8 messages) 8 messages, 3 authors, 2016-06-15

Re: [PATCH 2/2] pager_in_use: make sure output is still going to pager

From: Johannes Schindelin <hidden>
Date: 2016-06-15 23:06:08

Hi Peff,

On 2015-08-10 07:23, Jeff King wrote:
quoted hunk ↗ jump to hunk
diff --git a/compat/pipe-id.c b/compat/pipe-id.c
new file mode 100644
index 0000000..4764c5f
--- /dev/null
+++ b/compat/pipe-id.c
@@ -0,0 +1,25 @@
+#include "git-compat-util.h"
+#include "compat/pipe-id.h"
+#include "strbuf.h"
+
+const char *pipe_id_get(int fd)
+{
+	static struct strbuf id = STRBUF_INIT;
+	struct stat st;
+
+	if (fstat(fd, &st) < 0 || !S_ISFIFO(st.st_mode))
+		return NULL;
Just a quick note: it seems that this check is not really working on Windows. I tested this by running this test case manually (because TTY is not set on Windows):
+test_expect_success TTY 'no color when paged program writes to pipe' '
+	test_config alias.externallog "!git log | cat >log.out" &&
+	test_config color.ui auto &&
+	test_terminal env TERM=vt100 git -p externallog &&
+	test_line_count = 0 paginated.out &&
+	test -s log.out &&
+	! colorful log.out
+'
The output is "colorful" ;-)

I hope to find some time tomorrow to figure out some workaround that makes this work on Windows.

Ciao,
Dscho
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help