diff options
author | Pádraig Brady <P@draigBrady.com> | 2016-09-06 15:13:32 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2016-09-07 10:20:39 +0100 |
commit | 6643842bad2e0ed9f9249f2039d2a30c3b7fb38d (patch) | |
tree | 08c22290c3c04e978e53eb9c012cc7a0f933bbbd /src | |
parent | 5445f7811ff945ea13aa2a0fd797eb4c0a0e4db0 (diff) | |
download | coreutils-6643842bad2e0ed9f9249f2039d2a30c3b7fb38d.tar.xz |
factor: reinstate immediate output with interactive use
* src/factor.c (lbuf_putc): Only buffer more than a line
when not using the tool interactively.
* NEWS: Mention the bug fix.
Fixes http://pad.lv/1620139
Diffstat (limited to 'src')
-rw-r--r-- | src/factor.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/factor.c b/src/factor.c index 8fee75912..ff454b485 100644 --- a/src/factor.c +++ b/src/factor.c @@ -2379,7 +2379,13 @@ lbuf_putc (char c) { size_t buffered = lbuf.end - lbuf.buf; - if (buffered >= FACTOR_PIPE_BUF) + /* Provide immediate output for interactive input. */ + static int line_buffered = -1; + if (line_buffered == -1) + line_buffered = isatty (STDIN_FILENO); + if (line_buffered) + lbuf_flush (); + else if (buffered >= FACTOR_PIPE_BUF) { /* Write output in <= PIPE_BUF chunks so consumers can read atomically. */ |