Disable stdout buffering globally

This makes it possible to pipe output to other programs cleanly.
This commit is contained in:
V 2025-03-11 13:59:45 +00:00 committed by Martin Lund
parent 6aca9ffee5
commit 7567e08227
2 changed files with 4 additions and 4 deletions

View file

@ -61,6 +61,10 @@ int main(int argc, char *argv[])
/* Configure tty device */ /* Configure tty device */
tty_configure(); tty_configure();
/* Disable line buffering in stdout. This is necessary if we
* want things like local echo to work correctly. */
setvbuf(stdout, NULL, _IONBF, 0);
/* Configure input terminal */ /* Configure input terminal */
if (isatty(fileno(stdin))) if (isatty(fileno(stdin)))
{ {

View file

@ -1184,10 +1184,6 @@ void stdout_configure(void)
{ {
int status; int status;
/* Disable line buffering in stdout. This is necessary if we
* want things like local echo to work correctly. */
setvbuf(stdout, NULL, _IONBF, 0);
/* Save current stdout settings */ /* Save current stdout settings */
if (tcgetattr(STDOUT_FILENO, &stdout_old) < 0) if (tcgetattr(STDOUT_FILENO, &stdout_old) < 0)
{ {