octave-maintainers
[Top][All Lists]
Advanced

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

Re: Octave's exit status


From: Julien Bect
Subject: Re: Octave's exit status
Date: Fri, 9 Dec 2016 14:42:27 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.4.0

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.

Here are similar examples using other scripting langages :

$ python -c "1+#"
  File "<string>", line 1
    1+#
      ^
SyntaxError: invalid syntax
$ echo $?
1

$  R -q -e "1+#"
> 1+#
+
+ Erreur : unexpected end of input
Exécution arrêtée

$ echo $?
1

$ perl -e "1+#"
syntax error at -e line 1, at EOF
Execution of -e aborted due to compilation errors.

$ echo $?
255

@++
Julien



reply via email to

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