Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Odd behavior using MULTIOS
- X-seq: zsh-users 26148
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: Odd behavior using MULTIOS
- Date: Wed, 11 Nov 2020 16:42:06 +0000 (GMT)
- Archived-at: <https://zsh.org/users/26148>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-users/2020-11/774738440.1331269.1605112926240%40mail2.virginmedia.com>
- Authentication-results: zsh.org; iprev=pass (smtpq1.tb.ukmail.iss.as9143.net) smtp.remote-ip=212.54.57.96; dkim=pass header.d=ntlworld.com header.s=meg.feb2017 header.a=rsa-sha256; dmarc=pass header.from=ntlworld.com; arc=none
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ntlworld.com; s=meg.feb2017; t=1605112926; bh=DKbaHWFvFIAQxbr5EzixGL2Cr0i/1lw5CELzFpt9NNY=; h=Date:From:To:In-Reply-To:References:Subject; b=hwdqJ4csFBrYkvaLHsj8pRO3qw2vD4iopVTjYBYevtLT0BI1Cwmm29+9rlVfKmvKp /UY1Zoefb4rwqAvCSGlgAGukHN9XDdDGYlF1qcCYrjEC/j/m6nXR/3V/RyksW9ekK2 7ziCmLeJ3n2gPvIKWic5uv76OyeFPJbfDxFGOV+P6jOQDd3m+Nma41SuC2vrqzDXC/ fOy5URMQTuIv8MztZv4iyQhpF4TzXeSARvMA8DJeWpu97J9bmx9Ltr2dG8BOk32c98 hKzPxo4O+wp1sUwYHD35X6wg4eZrNeQiZVCz/mnxeu4H5ZsmJ/4sk8rvtPBBR++DOG psdHJQmfEXGYA==
- Importance: Medium
- In-reply-to: <02c5fda1-c1ab-d0a0-9350-a5b122cd1394@zentaur.org>
- List-archive: <http://www.zsh.org/sympa/arc/zsh-users>
- List-help: <mailto:sympa@zsh.org?subject=help>
- List-id: <zsh-users.zsh.org>
- List-owner: <mailto:zsh-users-request@zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-subscribe: <mailto:sympa@zsh.org?subject=subscribe%20zsh-users>
- List-unsubscribe: <mailto:sympa@zsh.org?subject=unsubscribe%20zsh-users>
- References: <02c5fda1-c1ab-d0a0-9350-a5b122cd1394@zentaur.org>
- Sender: zsh-users-request@xxxxxxx
> On 11 November 2020 at 16:25 Clinton Bunch <cdb_zsh@xxxxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author