* src/factor.c (lbuf_putc): Use line buffered mode if the standard
output 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
* NEWS: Mention the fix.
Fixes https://bugs.gnu.orv/35046
** Bug fixes
+ factor again outputs immediately when stdout is a tty but stdin is not.
+ [bug introduced in coreutils-8.24]
+
ln works again on old systems without O_DIRECTORY support (like Solaris 10),
and on systems where symlink ("x", ".") fails with errno == EINVAL
(like Solaris 10 and Solaris 11).
{
size_t buffered = lbuf.end - lbuf.buf;
- /* Provide immediate output for interactive input. */
+ /* Provide immediate output for interactive use. */
static int line_buffered = -1;
if (line_buffered == -1)
- line_buffered = isatty (STDIN_FILENO);
+ line_buffered = isatty (STDIN_FILENO) || isatty (STDOUT_FILENO);
if (line_buffered)
lbuf_flush ();
else if (buffered >= FACTOR_PIPE_BUF)