mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-27 16:50:58 +01:00
Sven: 13108: Handle traps synchronously
pws: 13109, 13111: clear up zle display when output produced in trap.
This commit is contained in:
parent
89d480f57d
commit
c292a3ae50
15 changed files with 387 additions and 202 deletions
30
Src/utils.c
30
Src/utils.c
|
|
@ -1417,13 +1417,39 @@ checkrmall(char *s)
|
|||
return (getquery("ny", 1) == 'y');
|
||||
}
|
||||
|
||||
/**/
|
||||
mod_export int
|
||||
ztrapread(int fd, char *buf, int len)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ALLOWTRAPS {
|
||||
ret = read(fd, buf, len);
|
||||
} DISALLOWTRAPS;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**/
|
||||
mod_export int
|
||||
ztrapwrite(int fd, char *buf, int len)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ALLOWTRAPS {
|
||||
ret = write(fd, buf, len);
|
||||
} DISALLOWTRAPS;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**/
|
||||
int
|
||||
read1char(void)
|
||||
{
|
||||
char c;
|
||||
|
||||
while (read(SHTTY, &c, 1) != 1) {
|
||||
while (ztrapread(SHTTY, &c, 1) != 1) {
|
||||
if (errno != EINTR || errflag || retflag || breaks || contflag)
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -1440,7 +1466,7 @@ noquery(int purge)
|
|||
ioctl(SHTTY, FIONREAD, (char *)&val);
|
||||
if (purge) {
|
||||
for (; val; val--)
|
||||
read(SHTTY, &c, 1);
|
||||
ztrapread(SHTTY, &c, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue