Fix ^C handling.
This commit is contained in:
parent
38021971e3
commit
9a3719817e
1 changed files with 11 additions and 2 deletions
13
tts.c
13
tts.c
|
|
@ -470,6 +470,10 @@ struct kevent64_s evs[2], rev;
|
||||||
|
|
||||||
if ((nev = kevent64(kq, NULL, 0, &rev, 1, 0,
|
if ((nev = kevent64(kq, NULL, 0, &rev, 1, 0,
|
||||||
running ? &timeout : NULL)) == -1) {
|
running ? &timeout : NULL)) == -1) {
|
||||||
|
if (doexit)
|
||||||
|
break;
|
||||||
|
if (errno == EINTR)
|
||||||
|
continue;
|
||||||
perror("kevent");
|
perror("kevent");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
@ -493,8 +497,13 @@ struct kevent64_s evs[2], rev;
|
||||||
* If there's a running entry, wake up in 0.5 seconds time to update
|
* If there's a running entry, wake up in 0.5 seconds time to update
|
||||||
* the display. Otherwise, we can sleep forever.
|
* the display. Otherwise, we can sleep forever.
|
||||||
*/
|
*/
|
||||||
select(STDIN_FILENO + 1, &in_set, NULL, NULL,
|
if (select(STDIN_FILENO + 1, &in_set, NULL, NULL,
|
||||||
running ? &timeout : NULL);
|
running ? &timeout : NULL) == -1) {
|
||||||
|
if (doexit)
|
||||||
|
break;
|
||||||
|
if (errno == EINTR)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!FD_ISSET(STDIN_FILENO, &in_set))
|
if (!FD_ISSET(STDIN_FILENO, &in_set))
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue