Skip to content

Commit aa80ba2

Browse files
authored
[update] fix finsh bug (#5676)
* [update] fix finsh bug * [update] format code
1 parent 75a7cb6 commit aa80ba2

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

components/finsh/shell.c

+10-1
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,17 @@ int finsh_getchar(void)
168168
}
169169

170170
while (rt_device_read(device, -1, &ch, 1) != 1)
171+
{
171172
rt_sem_take(&shell->rx_sem, RT_WAITING_FOREVER);
172-
173+
if (shell->device != device)
174+
{
175+
device = shell->device;
176+
if (device == RT_NULL)
177+
{
178+
return -1;
179+
}
180+
}
181+
}
173182
return ch;
174183
#endif /* RT_USING_POSIX_STDIO */
175184
#else

0 commit comments

Comments
 (0)