zsh-workers
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Bug? Output not flushed?
Date: Fri, 15 Sep 2023 19:05:00 +0200	[thread overview]
Message-ID: <CAHYJk3QbXntu6F7MAcweg5m0iRXp0QmuSkdWP2DfDxNJ=TYHWg@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7YnQmbVqNKHmt6nthB-+1KdFYhXt2vfVu2_uHP6S5RxMg@mail.gmail.com>

On 9/15/23, Bart Schaefer <schaefer@brasslantern.com> wrote:
> Easily reproduced:
>
> % { print XXX; return 0; } >| /tmp/newfile; print $(</tmp/newfile)
> % print $(</tmp/newfile)
> XXX
>
> That is, when a return statement appears in a current-shell complex
> list, the output is not flushed until the parser reaches the top level
> again.

I'm not sure if that diagnosis is correct, look at this:
% { print XXX; return 0; } >| /tmp/newfile; echo hello; print $(</tmp/newfile)

and if you put a sleep 10 in there, it still completes immediately,
ie, does the return just return from the whole statement? Isn't that
actually expected since it's not in a function or subshell?

>  If the return statement is removed, all is well:
>
> % { print YYY; } >| /tmp/newfile; print $(</tmp/newfile)
> YYY
> %
>
> Any idea where to start looking for this?

-- 
Mikael Magnusson


  reply	other threads:[~2023-09-15 17:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-15 16:56 Bart Schaefer
2023-09-15 17:05 ` Mikael Magnusson [this message]
2023-09-15 17:30   ` Bart Schaefer
2023-09-15 22:22     ` [PATCH] ? Parse error does not always set $? (Was: Bug? Output not flushed?) Bart Schaefer
2023-09-16  1:20       ` 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='CAHYJk3QbXntu6F7MAcweg5m0iRXp0QmuSkdWP2DfDxNJ=TYHWg@mail.gmail.com' \
    --to=mikachu@gmail.com \
    --cc=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).