From mboxrd@z Thu Jan 1 00:00:00 1970 From: john at keeping.me.uk (John Keeping) Date: Sat, 14 Oct 2017 17:14:21 +0100 Subject: [PATCH 0/4] adding color to ui-blame In-Reply-To: <20171014141750.14013-1-Jason@zx2c4.com> References: <20171014141750.14013-1-Jason@zx2c4.com> Message-ID: <20171014161421.GJ25019@john.keeping.me.uk> On Sat, Oct 14, 2017 at 04:17:46PM +0200, Jason A. Donenfeld wrote: > This patch set is currently broken, because in the exec filter, > processes like to buffer their output. The result is that the text winds > up at the bottom: > > https://git.zx2c4.com/cgit/blame/cache.c > > If anybody has some ideas on how we might enact a flush operation, please > pipe up (hah). The only thing I can think of is stdbuf, but that uses LD_PRELOAD internally and only works if the filter only uses the default stdio buffering and processing the input incrementally; our syntax-highlighting.py slurps the entire input stream before outputting anything. I wonder if it would be more reliable to split the output of the filter on the assumption that there is a one-to-one mapping from input lines to output lines. Both of the filters we ship do this, although the Python version dumps out a stylesheet before starting the document. Having thought about this a bit, I can't see any way to make this work reliably with our current filter protocol. Maybe we should consider introducing a more capable protocol for source filters that is designed to be usable in this scenario.