grc icon indicating copy to clipboard operation
grc copied to clipboard

progressively coloring character instead of line output

Open 1-61803 opened this issue 8 years ago • 4 comments

When a command progressively sends characters to stdout on the same line, grc waits for the whole line, applies color and eventually returns the output. Here's an example with traceroute on OS X.

2-1 2-2

I would expect it to colourise each timeout char as soon as it happens, instead of buffering the whole line.

1-1 1-2 1-3

1-61803 avatar Jul 11 '16 19:07 1-61803

My fix for this in the meantime is to prefix my aliases with stdbuf -oL

https://www.gnu.org/software/coreutils/manual/html_node/stdbuf-invocation.html

See https://github.com/garabik/grc/issues/25#issuecomment-251001275

derimagia avatar Oct 30 '16 03:10 derimagia

@derimagia, that also does line buffering. So in case of traceroute, I have to wait for a node not responding the default 15" timeout interval for 3 probes, before the 3 asterisks are colourized red (see my first example above).

1-61803 avatar Oct 30 '16 15:10 1-61803

Sorry misunderstood since for me the traceroute didn't even buff per line before I changed it. Buffing per character would be really difficult to do since it relies on regex. Work may be easier but even then it's difficult

derimagia avatar Oct 31 '16 00:10 derimagia

grc 1.9 buffers lines in my system (10.8.5) by default. I don't know if character buffering would be possible — anyway, gstdbuf doesn't accept less than 1 K/KB, in case that'd be an option.

1-61803 avatar Oct 31 '16 08:10 1-61803