octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Octave's exit status


From: Olaf Till
Subject: Re: Octave's exit status
Date: Fri, 9 Dec 2016 15:08:27 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

On Fri, Dec 09, 2016 at 02:42:27PM +0100, Julien Bect wrote:
> Le 09/12/2016 à 14:33, Bernardo Sulzbach a écrit :
> >On 12/09/2016 06:47 AM, Julien Bect wrote:
> >>Hi all,
> >>
> >>I observe the following with Octave 4.2.0:
> >>
> >>$ octave --eval '1+?'
> >>parse error:
> >>
> >>  syntax error
> >>
> >>>>>1+?
> >>      ^
> >>
> >>error: unhandled execution exception -- eval failed
> >>
> >>$ echo $?
> >>0
> >>
> >>Is this a feature or a bug ?
> >>
> >
> >I can't answer for who wrote the code, but I don't consider this a bug
> >myself. I don't think that Octave itself failed as much as the evaluation
> >failed (the reasons are clearly presented, too). This seems to me a
> >successful attempt to evaluate an expression, even though this resolves
> >into errors.
> >
> >I don't think it would be an issue to return a nonzero value in this case,
> >but I also don't think it would fix anything.
> 
> Yes, it would fix something (for me) : if an Octave script is called inside
> a Makefile, then make would stop after the error.

For all but syntax errors, you could work around the problem with:

octave --eval 'try maybe_cause_an_error () catch exit (1) end_try_catch'

But if seeing Octave as a scripting language, I'd agree that it should
return non-zero if a command goes wrong. BTW this behaviour seems to
have changed from 4.0 to 4.2.

Olaf

-- 
public key id EAFE0591, e.g. on x-hkp://pool.sks-keyservers.net

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]