[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#35046: [PATCH] factor: check the standard output instead of the stan
From: |
Pádraig Brady |
Subject: |
bug#35046: [PATCH] factor: check the standard output instead of the standard input |
Date: |
Sat, 30 Mar 2019 14:58:52 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 |
On 29/03/19 23:43, Shugo Maeda wrote:
> * src/factor.c (lbuf_putc): Use line buffered mode if the standard
> output (not the standard input) is a terminal in the same way as the
> stdio library. User programs might use pty only for the standard out
> like the example of Ruby's PTY module:
> https://docs.ruby-lang.org/en/2.6.0/PTY.html#module-PTY-label-Example
> ---
> src/factor.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/factor.c b/src/factor.c
> index 39e8918ff..173774045 100644
> --- a/src/factor.c
> +++ b/src/factor.c
> @@ -2403,7 +2403,7 @@ lbuf_putc (char c)
> /* Provide immediate output for interactive input. */
> static int line_buffered = -1;
> if (line_buffered == -1)
> - line_buffered = isatty (STDIN_FILENO);
> + line_buffered = isatty (STDOUT_FILENO);
> if (line_buffered)
> lbuf_flush ();
> else if (buffered >= FACTOR_PIPE_BUF)
That would impact use cases like:
factor | sed -u 's/.*: *//'
Do you have a use case like:
slow_generator | factor
To support both we could line buffer if either stdin/out is a tty.
To support the following we'd need a flag:
slow_generator | factor | sed -u 's/.*: *//'
cheers,
Pádraig