From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [PATCH] reading from large or "infinite" source in multio
Date: Sat, 18 Nov 2023 15:24:00 -0800 [thread overview]
Message-ID: <CAH+w=7ZK1TndfBghSKWg6T8Q_3e4ruMxN8MxA-VqRi5+0GqHiQ@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7Z4U9JjZAW8YBreVmbr2xS8WwSm+YDUTpf_GHuiQ0DrDg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 458 bytes --]
On Thu, Nov 16, 2023 at 5:27 PM Bart Schaefer <schaefer@brasslantern.com> wrote:
>
> Why not this? Any reason that errors from write_loop() should be ignored?
Small addition to that patch: There's no good reason that the tee/cat
loops should act like interactive shells for purposes of signal
handling etc.
The error checks on the return from write_loop() appear less necessary
once dont_queue_signals() is asserted, but seem prudent anyway.
[-- Attachment #2: procsubs-write_loop.txt --]
[-- Type: text/plain, Size: 800 bytes --]
diff --git a/Src/exec.c b/Src/exec.c
index 97823760f..7d8135266 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -2290,6 +2290,8 @@ closemn(struct multio **mfds, int fd, int type)
return;
}
/* pid == 0 */
+ opts[INTERACTIVE] = 0;
+ dont_queue_signals();
child_unblock();
closeallelse(mn);
if (mn->rflag) {
@@ -2302,7 +2304,8 @@ closemn(struct multio **mfds, int fd, int type)
break;
}
for (i = 0; i < mn->ct; i++)
- write_loop(mn->fds[i], buf, len);
+ if (write_loop(mn->fds[i], buf, len) < 0)
+ break;
}
} else {
/* cat process */
@@ -2314,7 +2317,8 @@ closemn(struct multio **mfds, int fd, int type)
else
break;
}
- write_loop(mn->pipe, buf, len);
+ if (write_loop(mn->pipe, buf, len) < 0)
+ break;
}
}
_exit(0);
next prev parent reply other threads:[~2023-11-18 23:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-12 15:59 Bug: reading from tty inside process substitution Mark J. Reed
2023-11-12 18:09 ` Bart Schaefer
2023-11-12 21:50 ` Bart Schaefer
2023-11-15 3:33 ` Bart Schaefer
2023-11-15 4:42 ` Bart Schaefer
2023-11-15 5:00 ` Bart Schaefer
2023-11-16 4:58 ` Bart Schaefer
2023-11-17 1:27 ` [PATCH] reading from large or "infinite" source in multio Bart Schaefer
2023-11-18 23:24 ` Bart Schaefer [this message]
2023-11-16 2:35 ` [PATCH] reading from tty inside process substitution Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAH+w=7ZK1TndfBghSKWg6T8Q_3e4ruMxN8MxA-VqRi5+0GqHiQ@mail.gmail.com' \
--to=schaefer@brasslantern.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).