Skip to content

Commit

Permalink
Merge pull request #10630 from jcarrano/shell-flush-echo
Browse files Browse the repository at this point in the history
sys/shell: ensure character is flushed when echoing.
  • Loading branch information
jcarrano authored Feb 12, 2019
2 parents fa48e66 + b34dc3a commit f344bb2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions sys/shell/shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ static void _putchar(int c) {
#endif
#endif

static void flush_if_needed(void)
{
#ifdef MODULE_NEWLIB
fflush(stdout);
#endif
}

static shell_command_handler_t find_handler(const shell_command_t *command_list, char *command)
{
const shell_command_t *command_lists[] = {
Expand Down Expand Up @@ -265,6 +272,7 @@ static int readline(char *buf, size_t size)
_putchar(c);
#endif
}
flush_if_needed();
}
}

Expand All @@ -275,9 +283,7 @@ static inline void print_prompt(void)
_putchar(' ');
#endif

#ifdef MODULE_NEWLIB
fflush(stdout);
#endif
flush_if_needed();
}

void shell_run(const shell_command_t *shell_commands, char *line_buf, int len)
Expand Down

0 comments on commit f344bb2

Please sign in to comment.