shell: don't ignore IO errors
This commit is contained in:
parent
3f289760bf
commit
a1df6a86bb
@ -217,6 +217,9 @@ static int readline(shell_t *shell, char *buf, size_t size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
c = shell->readchar();
|
c = shell->readchar();
|
||||||
|
if (c < 0) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
shell->put_char(c);
|
shell->put_char(c);
|
||||||
|
|
||||||
/* We allow Unix linebreaks (\n), DOS linebreaks (\r\n), and Mac linebreaks (\r). */
|
/* We allow Unix linebreaks (\n), DOS linebreaks (\r\n), and Mac linebreaks (\r). */
|
||||||
|
|||||||
@ -53,7 +53,10 @@ static void print_echo(int argc, char **argv)
|
|||||||
static int shell_readc(void)
|
static int shell_readc(void)
|
||||||
{
|
{
|
||||||
char c;
|
char c;
|
||||||
posix_read(uart0_handler_pid, &c, 1);
|
int result = posix_read(uart0_handler_pid, &c, 1);
|
||||||
|
if (result != 1) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
return (unsigned char) c;
|
return (unsigned char) c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user