Skip to content

Commit bdf5a1f

Browse files
judecumtmysterywolf
authored andcommitted
[components][finsh]在RT_USING_POSIX_STDIO时,使用get_console获取当前console描述符
1 parent 96165a5 commit bdf5a1f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

components/finsh/shell.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@
3232
#include <fcntl.h>
3333
#endif /* DFS_USING_POSIX */
3434

35+
#ifdef RT_USING_POSIX_STDIO
36+
#include <unistd.h>
37+
#include <posix/stdio.h>
38+
#endif /* RT_USING_POSIX_STDIO */
39+
3540
/* finsh thread */
3641
#ifndef RT_USING_HEAP
3742
static struct rt_thread finsh_thread;
@@ -154,7 +159,7 @@ int finsh_getchar(void)
154159
#ifdef RT_USING_DEVICE
155160
char ch = 0;
156161
#ifdef RT_USING_POSIX_STDIO
157-
if(read(STDIN_FILENO, &ch, 1) > 0)
162+
if(read(rt_posix_stdio_get_console(), &ch, 1) > 0)
158163
{
159164
return ch;
160165
}

0 commit comments

Comments
 (0)