From: Mikael Magnusson <mikachu@gmail.com>
To: Daniel Shahaf <d.s@daniel.shahaf.name>,
zsh workers <zsh-workers@zsh.org>
Subject: Re: [PATCH] typeset: set $? on incidental error
Date: Mon, 18 Jan 2016 14:33:32 +0100 [thread overview]
Message-ID: <CAHYJk3SU6dcOwwUe90ib1RDzhUiLo_xrvgz=0-rFwTRLcidxiA@mail.gmail.com> (raw)
In-Reply-To: <CAHYJk3T6hkQez_zUsRKngRoAm80Xr5Od-=51KWGf9bRWkmRqaA@mail.gmail.com>
On Mon, Jan 18, 2016 at 5:38 AM, Mikael Magnusson <mikachu@gmail.com> wrote:
> On Mon, Jan 18, 2016 at 3:25 AM, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
>> Mikael Magnusson wrote on Fri, Jan 15, 2016 at 15:46:09 +0100:
>>> On Fri, Jan 15, 2016 at 7:26 AM, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
>>> > Eric Cook wrote on Thu, Jan 14, 2016 at 00:24:36 -0500:
>>> >> On 01/13/2016 07:13 PM, Daniel Shahaf wrote:
>>> >> > The 'typeset' family of builtins doesn't set $? when one would expect it
>>> >> > to do so:
>>> >> >
>>> >> > % x=$(true) y=$(exit 42); echo $?
>>> >> > 42
>>> >> > % local x=$(true) y=$(exit 42); echo $?
>>> >> > 0
>>> >> >
>>> >> > This patch makes 'typeset' behave as ordiary assignment does.
>>> >>
>>> >>
>>> >> But who expects that?
>>> >
>>> > I did.
>>>
>>> local/typeset is a command, and it was successful, so I don't see why
>>> $? should be set to anything else than 0.
>>> % true x=$(false); echo $?
>>> 0
>>> is technically exactly the same situation as your above second command.
>>
>> I wouldn't call it successful: I asked for the parameter x to be created
>> as a scalar and assigned a value and only part of my request was
>> accomplished.
>
> That's not true, the parameter is created and assigned the value you
> asked for (your command subst had empty output so the parameter is ""
> but if you did local y=$(echo hi; exit 42) it would be "42".)
It would be "hi" rather, of course.
--
Mikael Magnusson
next prev parent reply other threads:[~2016-01-18 13:33 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-14 0:13 Daniel Shahaf
2016-01-14 4:58 ` Bart Schaefer
2016-01-14 5:24 ` Eric Cook
2016-01-15 6:26 ` Daniel Shahaf
2016-01-15 14:46 ` Mikael Magnusson
2016-01-15 14:54 ` Eric Cook
2016-01-15 15:49 ` Peter Stephenson
[not found] ` <20160118022557.GE3979@tarsus.local2>
2016-01-18 4:38 ` Mikael Magnusson
2016-01-18 13:33 ` Mikael Magnusson [this message]
2016-01-20 7:47 ` Daniel Shahaf
2016-01-20 15:00 ` Eric Cook
2016-01-23 23:53 ` Daniel Shahaf
2016-01-24 3:32 ` Eric Cook
2016-01-26 22:50 ` Daniel Shahaf
2016-01-27 4:15 ` Error status of "repeat" (was Re: [PATCH] typeset: set $? on incidental error) Bart Schaefer
2016-01-27 4:38 ` Bart Schaefer
2016-01-27 9:52 ` Peter Stephenson
2016-01-29 9:18 ` Daniel Shahaf
2016-01-29 9:29 ` Peter Stephenson
2016-01-29 10:25 ` Daniel Shahaf
2016-01-27 4:17 ` [PATCH] typeset: set $? on incidental error Bart Schaefer
2016-01-29 9:18 ` Daniel Shahaf
2016-01-30 7:46 ` typeset docs flow " Daniel Shahaf
2016-01-30 19:47 ` Bart Schaefer
2016-01-31 0:49 ` Jun T.
2016-01-31 17:03 ` Bart Schaefer
2016-02-01 3:23 ` Jun T.
2016-02-01 5:41 ` Bart Schaefer
2016-01-21 14:22 ` Vincent Lefevre
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='CAHYJk3SU6dcOwwUe90ib1RDzhUiLo_xrvgz=0-rFwTRLcidxiA@mail.gmail.com' \
--to=mikachu@gmail.com \
--cc=d.s@daniel.shahaf.name \
--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).