zsh-workers
 help / color / mirror / code / Atom feed
From: Stephane Chazelas <Stephane_Chazelas@yahoo.fr>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh hackers list <zsh-workers@sunsite.dk>
Subject: Re: PATCH: skip command from debug trap
Date: Wed, 6 Aug 2008 15:59:17 +0100	[thread overview]
Message-ID: <20080806145917.GE5197@sc.homeunix.net> (raw)
In-Reply-To: <080806072236.ZM14655@torch.brasslantern.com>

On Wed, Aug 06, 2008 at 07:22:36AM -0700, Bart Schaefer wrote:
[...]
> 	x=3
> 	return --x
> 
> returns "2".  How are you going to make any kind of option parsing for
> return behave compatibly with that? 

See for instance kill(1). To kill a process group, you have to
do:

kill -- -<pid>

So you'd have to do

return -- -3

> } (In fact, the lack of option parsing, even --, in return is strictly a
> } bug, so this even makes it more compatible with other shells.)
> 
> It'd have to be only in emulation mode, then.

-- is not a valid math expression, so changing return -- so that
it is the same as "return" instead of giving an error message
shouldn't be a problem.

Changing return -1 so that it outputs an error message instead
of returning with $? == -1 could break existing scripts.

BTW, is this:

$ zsh -c '(){echo test;return 1}; echo $?'
test
0

the expected output?

-- 
Stéphane


  parent reply	other threads:[~2008-08-06 14:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-05 14:27 Peter Stephenson
2008-08-05 15:50 ` Stephane Chazelas
2008-08-05 23:47 ` Rocky Bernstein
2008-08-06  9:47   ` Peter Stephenson
2008-08-06 14:22     ` Bart Schaefer
2008-08-06 14:30       ` Rocky Bernstein
2008-08-06 14:59       ` Stephane Chazelas [this message]
2008-08-06 15:34         ` Peter Stephenson
2008-08-06 17:00     ` Rocky Bernstein
2008-08-06 17:54       ` Peter Stephenson
2008-08-06 19:09         ` Rocky Bernstein
2008-08-06 19:49           ` Peter Stephenson
2008-08-07  1:00             ` Bart Schaefer
2008-08-07 10:11               ` Peter Stephenson
2008-08-07 14:52                 ` 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=20080806145917.GE5197@sc.homeunix.net \
    --to=stephane_chazelas@yahoo.fr \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-workers@sunsite.dk \
    /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).