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

Re: Bug? Output not flushed?



On Fri, Sep 15, 2023 at 10:05 AM Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
>
> I'm not sure if that diagnosis is correct, look at this:
> % { print XXX; return 0; } >| /tmp/newfile; echo hello; print $(</tmp/newfile)
>
> ie, does the return just return from the whole statement?

Hrm.  I was trying to come up with an example that DID NOT depend on
my ${ ... } nofork patch, but the semantics of return seem to make
that impossible.

If you have my full set of nofork patches installed:

% set -vx
% print IN ${ print NOFORK; return 0; } OUT
>| /tmp/zshw44kFq { print NOFORK; return 0;  ;}
+Src/zsh:3> print NOFORK
+Src/zsh:3> return 0
REPLY="$(</tmp/zshw44kFq)"
+Src/zsh:3> print IN OUT
IN OUT

The redirection has happened, the print has happened, and the
assignment to REPLY has happened, but the file was empty when read.
Unless something is actually aborting the $(...) ... will have to dig
further.

Thanks for the observation.




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