mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-29 11:40:28 +08:00
fix(top): stop when the input can't be polled (#29227)
This commit is contained in:
1 parent
4d7e4de777
commit
33109cd71d
1 file changed
+6
@@ -95,6 +95,12 @@ extern "C" __EXPORT int top_main(int argc, char *argv[])
|
|||||||
fds.events = POLLIN;
|
fds.events = POLLIN;
|
||||||
ret = poll(&fds, 1, 0);
|
ret = poll(&fds, 1, 0);
|
||||||
|
|
||||||
|
if ((ret < 0) || (fds.revents & POLLNVAL)) {
|
||||||
|
// no input to stop on, as from a shell without a terminal
|
||||||
|
cpuload_monitor_stop();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
|
|
||||||
ret = read(0, &c, 1);
|
ret = read(0, &c, 1);
|
||||||
|
|||||||
Reference in new issue
Block a user