Skip to content

Commit

Permalink
unix/input: Flush the prompt after writing it to stdout.
Browse files Browse the repository at this point in the history
Depending on your setup, stdout might be buffered/line-buffered.

Signed-off-by: YAMAMOTO Takashi <yamamoto@midokura.com>
  • Loading branch information
yamt authored and dpgeorge committed Feb 15, 2024
1 parent 06cb6b1 commit f9704ce
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions ports/unix/input.c
Expand Up @@ -43,6 +43,7 @@ char *prompt(char *p) {
// simple read string
static char buf[256];
fputs(p, stdout);
fflush(stdout);
char *s = fgets(buf, sizeof(buf), stdin);
if (!s) {
return NULL;
Expand Down

0 comments on commit f9704ce

Please sign in to comment.