Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Unexpected stdin-behavior

On Thu, Oct 21, 2021 at 9:47 AM Tycho Kirchner <tychokirchner@xxxxxxx> wrote:
> thanks for your response. Could you please elaborate how your answer
> explains the difference in the output between the commands
> zsh -s and
> zsh -s -i
> ?

When -i is NOT present, stdin is set to line buffered for the stdio library.

I don't actually see any difference between -s and -s -i except for
the printing of the prompt, when I try it with the latest development
version, and the only code difference is the removal of stdio.  This
is probably an unintentional behavior change in the new code, and may
bear looking into.

For zsh-workers (particularly PWS), I'm referring to this bit of code in init.c:

     * Finish setting up SHIN and its relatives.
    if (isset(SHINSTDIN) && !SHIN && unset(INTERACTIVE)) {
#ifdef _IONBF
        setvbuf(stdin, NULL, _IONBF, 0);

We either don't need the set*buf business at all, or we need its
equivalent for shinbuf, I think.

Messages sorted by: Reverse Date, Date, Thread, Author