zsh-users
 help / color / mirror / code / Atom feed
From: Clinton Bunch <cdbunch@zentaur.org>
To: zsh-users@zsh.org
Subject: Re: Odd behavior using MULTIOS
Date: Wed, 11 Nov 2020 11:11:01 -0600	[thread overview]
Message-ID: <590c200a-7f5c-bfa5-bd1f-1bbcad50585e@zentaur.org> (raw)
In-Reply-To: <774738440.1331269.1605112926240@mail2.virginmedia.com>

Another thing I noticed is that MULTIOS doesn't appear to work with exec

i.e.

exec 3>/tmp/test1 3>/tmp/test2

causes the script to hang.

I'm not sure why.  Am I just being dense today?

On 11/11/2020 10:42 AM, Peter Stephenson wrote:
>> On 11 November 2020 at 16:25 Clinton Bunch <cdb_zsh@zentaur.org> wrote:
>> Is this the expected behavior?
>>
>> setopt MULTIOS
>> {
>> print -u3 "Testing"
>> print  "Second Testing"
>> } 3>&1 3>/tmp/test
>> % zsh test.zsh
>> Second Testing
>> Testing
> You mean the ordering?  Yes, as documented "the shell opens the file descriptor as a pipe
> to  a process that copies its input to all the specified outputs".  So this isn't
> synchronous within the current shell and you can't rely on ordering.  You'll note
> there's nothing there to determine whether the downstream pipe component performs
> a write to the terminal before the main shell does --- think of it a bit like
>
> { print Testing; print "Second Testing" >/dev/tty } | tee /dev/tty /tmp/test
>
> --- although I'm not guaranteeing they're identical and clearly there's room
> for lots of things in the two processes to affect the ordering.
>
> pws
>


  reply	other threads:[~2020-11-11 17:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-11 16:25 Clinton Bunch
2020-11-11 16:42 ` Peter Stephenson
2020-11-11 17:11   ` Clinton Bunch [this message]
2020-11-11 17:25     ` Peter Stephenson
2020-11-11 17:36       ` Clinton Bunch

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=590c200a-7f5c-bfa5-bd1f-1bbcad50585e@zentaur.org \
    --to=cdbunch@zentaur.org \
    --cc=zsh-users@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).