Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] Fix ctrl-c not working after process substitution
- X-seq: zsh-workers 44214
- From: Eric Freese <ericdfreese@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH] Fix ctrl-c not working after process substitution
- Date: Tue, 9 Apr 2019 12:34:04 -0600
- Cc: Eric Freese <ericdfreese@xxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=YGPkWCQE8Q/zykDXGl1pgeTd6pA2YKW1fCI+Hv5vVVY=; b=Vw6rrsOxZ8qKjWhZtgKIP9QG5Xy0LDVkwZlJEcFc/JuRffyyFz0hiOKuDyqotS7OsF ioQKyi4TTpW1+3e3BedSPKZLC89Ytqa1hEdCmgod5+WVn7Mc65kb84LE2+ezkcw1thqb RG05qi46qo5PiKtmsL+11u/gDD5Yd9A1lqUoP4w1yuJiOlZY7K4Ozdvissp6sOVGS50/ uZvNfg7CxfvBZXDZx0kg76f2regzGgk3aQnLxq7CxuxKxbHnY9zTagt/fx1mWqozYnOd ref6mjYkdm+S3cGrla+2lr/tpzIWj3f6Q23j7HusGCafHOA5qQQntIUCRUF9XXBrD2JV K0aQ==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
This is a potential fix for the ctrl-c problem reported in message 43148
You can reproduce the bug by running `zsh -f`, sourcing the following
.zshrc, and (at the prompt) pressing ^T and then ^C:
foo-request() {
exec {FD}< <(echo foo)
zle -F $FD foo-response
}
foo-response() {
zle -F $1
}
zle -N foo-request
bindkey ^T foo-request
After pressing ^T, ^C doesn't reset the prompt.
I think this is because the forked <(echo foo) process calls
entersubsh() without ESUB_ASYNC flag and so is set as the terminal's
controlling process. My hypothesis is that the original process is never
reset as the terminal's controlling process and thus the SIGINT signals
are no longer sent to the original process.
Adding ESUB_ASYNC flag to the entersubsh() call fixes the issue. I'm not
sure though if there are some cases where we don't want to add the flag
(e.g. when nullexec is 0)?
---
Src/exec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Src/exec.c b/Src/exec.c
index 79ef83c1e..6ac852112 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -4984,7 +4984,7 @@ getpipe(char *cmd, int nullexec)
procsubstpid = pid;
return pipes[!out];
}
- entersubsh(ESUB_PGRP, NULL);
+ entersubsh(ESUB_ASYNC|ESUB_PGRP, NULL);
redup(pipes[out], out);
closem(FDT_UNUSED, 0); /* this closes pipes[!out] as well */
cmdpush(CS_CMDSUBST);
--
2.19.0
Messages sorted by:
Reverse Date,
Date,
Thread,
Author