Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] reading from large or "infinite" source in multio
- X-seq: zsh-workers 52313
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: [PATCH] reading from large or "infinite" source in multio
- Date: Sat, 18 Nov 2023 15:24:00 -0800
- Archived-at: <https://zsh.org/workers/52313>
- In-reply-to: <CAH+w=7Z4U9JjZAW8YBreVmbr2xS8WwSm+YDUTpf_GHuiQ0DrDg@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAA=-s3xCf4wx826U8jEjO_j5-1kcTi8v2=VZPiabKMo-meKq0Q@mail.gmail.com> <CAH+w=7ZztRXt7R9fDK=yb1=fcvjwjiUGo98j73BgBG7NzWE+iw@mail.gmail.com> <CAH+w=7ZVJeo==zJjUi7OaUWt5nRqhif2ApTk5z5a0PD9mONc4Q@mail.gmail.com> <CAH+w=7abshTC3bJC6YRJOszsyzJEHbBLYZafzdGd4p8J8LK5xg@mail.gmail.com> <CAH+w=7Y6Tm=Ri4xTR_m4cEy3Sp+Be1Nx0B62Tj2mD8L8ObHtzQ@mail.gmail.com> <CAH+w=7Z0g804j+Pg1Q5O6dYpuDOYBdWcLAqSjV5u3SSd8hE_YA@mail.gmail.com> <CAH+w=7Z4U9JjZAW8YBreVmbr2xS8WwSm+YDUTpf_GHuiQ0DrDg@mail.gmail.com>
On Thu, Nov 16, 2023 at 5:27 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> 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.
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);
Messages sorted by:
Reverse Date,
Date,
Thread,
Author