From c292a3ae50bd0605b015f80266418e391c3c10fe Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Sat, 11 Nov 2000 19:50:27 +0000 Subject: Sven: 13108: Handle traps synchronously pws: 13109, 13111: clear up zle display when output produced in trap. --- Src/builtin.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'Src/builtin.c') diff --git a/Src/builtin.c b/Src/builtin.c index afd140d3c..d1cea8393 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -3218,7 +3218,7 @@ zexit(int val, int from_signal) checkjobs(); /* check if any jobs are running/stopped */ if (stopmsg) { stopmsg = 2; - LASTALLOC_RETURN; + return; } } if (in_exit++ && from_signal) @@ -3240,7 +3240,7 @@ zexit(int val, int from_signal) } } if (sigtrapped[SIGEXIT]) - dotrap(SIGEXIT); + dotrap(SIGEXIT, 1); runhookdef(EXITHOOK, NULL); if (mypid != getpid()) _exit(val); @@ -3486,7 +3486,7 @@ bin_read(char *name, char **args, char *ops, int func) *bptr = readchar; val = 1; readchar = -1; - } else if ((val = read(readfd, bptr, nchars)) <= 0) + } else if ((val = ztrapread(readfd, bptr, nchars)) <= 0) break; /* decrement number of characters read from number required */ @@ -3500,7 +3500,7 @@ bin_read(char *name, char **args, char *ops, int func) if (!izle && !ops['u'] && !ops['p']) { /* dispose of result appropriately, etc. */ if (isem) - while (val > 0 && read(SHTTY, &d, 1) == 1 && d != '\n'); + while (val > 0 && ztrapread(SHTTY, &d, 1) == 1 && d != '\n'); else settyinfo(&shttyinfo); if (haso) { @@ -3733,6 +3733,7 @@ static int zread(int izle, int *readchar) { char cc, retry = 0; + int ret; if (izle) { int c = getkeyptr(0); @@ -3756,7 +3757,8 @@ zread(int izle, int *readchar) } for (;;) { /* read a character from readfd */ - switch (read(readfd, &cc, 1)) { + ret = ztrapread(readfd, &cc, 1); + switch (ret) { case 1: /* return the character read */ return STOUC(cc); -- cgit 1.4.1