Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Interrupting globs (Re: Something rotten in tar completion)
On Sun, 7 Dec 2014 17:19:20 +0000
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> wrote:
> diff --git a/Src/jobs.c b/Src/jobs.c
> index 6e47e5e..3c2a21a 100644
> --- a/Src/jobs.c
> +++ b/Src/jobs.c
> @@ -1444,7 +1444,19 @@ zwaitjob(int job, int wait_cmd)
> restore_queue_signals(q);
> return 128 + last_signal;
> }
> - errflag &= ~ERRFLAG_ERROR;
> + /* Commenting this out makes ^C-ing a job started by a function
> + stop the whole function again. But I guess it will stop
> + something else from working properly, we have to find out
> + what this might be. --oberon
> +
> + When attempting to separate errors and interrupts, we
> + assumed because of the previous comment it would be OK
> + to remove ERRFLAG_ERROR and leave ERRFLAG_INT set, since
> + that's the one related to ^C. But that doesn't work.
> + There's something more here we don't understand. --pws
> +
> + errflag = 0; */
> +
> if (subsh) {
> killjb(jn, SIGCONT);
> jn->stat &= ~STAT_STOPPED;
Aha! Spotted when trying out TRY_BLOCK_INTERRUPT.
I only switched ERRFLAG_ERROR to ERRFLAG_INT when the shell *itself*
gets the interrupt. The case here, and in the test I was running, is
where we propagate a SIGINT detected by WTERMSIGing (er, that's a verb,
right?) a process that exited because it received the ^C (and the shell
wasn't part of the foreground process group).
The following patch (applicable to the interrupt_abort branch) makes
TRY_BLOCK_INTERRUPT do sensible things in that case. Needless to say I
haven't dared back off the patch quoted above again...
By the way, the cases below already handle SIGINT and SIGQUIT in
parallel, which suggest the code I added to do this for mimicking signals
on return from a trap is at least consistent.
diff --git a/Src/jobs.c b/Src/jobs.c
index 3c2a21a..a668b07 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -509,7 +509,7 @@ update_job(Job jn)
prev_errflag = errflag;
}
breaks = loops;
- errflag |= ERRFLAG_ERROR;
+ errflag |= ERRFLAG_INT;
inerrflush();
}
} else {
@@ -526,7 +526,7 @@ update_job(Job jn)
prev_errflag = errflag;
}
breaks = loops;
- errflag |= ERRFLAG_ERROR;
+ errflag |= ERRFLAG_INT;
inerrflush();
}
if (somestopped && jn->stat & STAT_SUPERJOB)
@@ -581,7 +581,7 @@ update_job(Job jn)
breaks = loops;
} else {
breaks = loops;
- errflag |= ERRFLAG_ERROR;
+ errflag |= ERRFLAG_INT;
}
check_cursh_sig(sig);
}
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author