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

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

[Octave-bug-tracker] [bug #65375] stdout is not flushed before message f


From: Rik
Subject: [Octave-bug-tracker] [bug #65375] stdout is not flushed before message from error()
Date: Mon, 26 Feb 2024 23:04:20 -0500 (EST)

URL:
  <https://savannah.gnu.org/bugs/?65375>

                 Summary: stdout is not flushed before message from error()
                   Group: GNU Octave
               Submitter: rik5
               Submitted: Mon 26 Feb 2024 08:04:20 PM PST
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: Confirmed
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: dev
         Discussion Lock: Any
        Operating System: Any
           Fixed Release: None
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Mon 26 Feb 2024 08:04:20 PM PST By: Rik <rik5>
Consider the attached code tst_err_reporting.m


function tst_err_reporting (do_anon = true)
  disp ("Entered function 'tst_err_reporting'");

  subfunction1 (do_anon);

end

function subfunction1 (do_anon)
  disp ("Entered function 'tst_err_reporting>subfunction1'");
 
  fanon = @(x) x + 1;

  if (do_anon)
    fanon (1, 2);   % Will cause a parse error
  else
    error ("calling error() function from 'subfunction1'");
  end

end



When run in Octave the output is


error: @<anonymous>: function called with too many inputs
error: called from
    subfunction1>@<anonymous>
    tst_err_reporting>subfunction1 at line 14 column 5
    tst_err_reporting at line 4 column 3
Entered function 'tst_err_reporting'
Entered function 'tst_err_reporting>subfunction1'


In Matlab, the strings from disp() are printed on stdout before the final
error backtrace.  This seems more logical as the code executes from top to
bottom and one would expect the messages to come out in the order in which
they were executed.

I think error() should probably be flushing stdout before it proceeds to write
to stderr.  There are similarities with bug #63806.






    _______________________________________________________
File Attachments:


-------------------------------------------------------
Name: tst_err_reporting.m  Size: 386B
<http://savannah.gnu.org/bugs/download.php?file_id=55756>

    AGPL NOTICE

These attachments are served by Savane. You can download the corresponding
source code of Savane at
https://git.savannah.nongnu.org/cgit/administration/savane.git/snapshot/savane-fd9b348a8fcb146b565f753e2f7db1ab857a7bf6.tar.gz

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?65375>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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