octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #47258] exit() causes empty line at stdout


From: Carnë Draug
Subject: [Octave-bug-tracker] [bug #47258] exit() causes empty line at stdout
Date: Fri, 26 Feb 2016 13:46:10 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0 Iceweasel/38.6.1

Follow-up Comment #5, bug #47258 (project octave):

I believe the attached cset fixes this issue.  There are newlines being
printed in a couple of places, and triggered by different things.  In an
Octave
session, the issue is that newlines are printed after catching an exception.
That newline is needed when Octave returns to prompt, for example, when
using Ctr+C at the prompt.  However, it is being printed before we decide
whether Octave needs to return to prompt at all.

In the case of running an Octave program or --eval, it seems that the
newline is not needed at all.  Error messages already have a newline.
Even when using --persist I didn't came up with a case where it is needed
so I removed the newline completely for those cases.

Here's a session with the attached patch:


$ cat finish_exit.m
disp ("hello");
exit ();
$ cat finish_eof.m
disp ("hello");
$ cat finish_error.m
disp ("hello");
error ("ups");
$ ./run-octave -qf --no-gui finish_exit.m
hello
$ ./run-octave -qf --no-gui finish_eof.m
hello
$ ./run-octave -qf --no-gui finish_error.m
hello
error: ups
error: unhandled execution exception
error: execution of finish_error.m failed
error: trying to make my way to a command prompt
$ ./run-octave -qf --no-gui --persist finish_exit.m
hello
$ ./run-octave -qf --no-gui --persist finish_eof.m
hello
>> exit
$ ./run-octave -qf --no-gui --persist finish_error.m
hello
error: ups
error: unhandled execution exception
error: execution of finish_error.m failed
error: trying to make my way to a command prompt
>> exit
$ ./run-octave -qf --no-gui
>> exit
$ ./run-octave -qf --no-gui
>> ^C
>> 
$ ./run-octave -qf --no-gui
>> ^C
>> 
$ # I exited the session above with Ctr+D


Any idea how to write a test for this stuff?

(file #36472)
    _______________________________________________________

Additional Item Attachment:

File name: no-newline-on-stdout.cset      Size:1 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?47258>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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