From fa57fb3c1c59f2a6590f4f410cf2d741c6caef4f Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Wed, 13 Mar 2019 20:17:25 +0800 Subject: [PATCH] console/linenoise: support buffered stdout --- components/console/linenoise/linenoise.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/console/linenoise/linenoise.c b/components/console/linenoise/linenoise.c index c0f551d67..f88a24620 100644 --- a/components/console/linenoise/linenoise.c +++ b/components/console/linenoise/linenoise.c @@ -106,6 +106,7 @@ #include #include #include +#include #include #include #include @@ -879,6 +880,9 @@ static int linenoiseEdit(char *buf, size_t buflen, const char *prompt) linenoiseEditDeletePrevWord(&l); break; } + if (__fbufsize(stdout) > 0) { + fflush(stdout); + } } return l.len; }