mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-23 00:04:02 -04:00
desktop: exit on EOF from stdin
This commit is contained in:
parent
3e5ec5d549
commit
4b50d2e639
@ -52,13 +52,21 @@ int main(int argc, char * const argv[])
|
||||
int fd_high = 0;
|
||||
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(0, &fds);
|
||||
loop();
|
||||
|
||||
desktop_serial_select_setup(&fds, &fd_high);
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100;
|
||||
|
||||
select(fd_high+1, &fds, NULL, NULL, &tv);
|
||||
if (select(fd_high+1, &fds, NULL, NULL, &tv) > 0 &&
|
||||
FD_ISSET(0, &fds)) {
|
||||
char c;
|
||||
if (read(0, &c, 1) != 1) {
|
||||
// EOF on stdin
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user