octave-maintainers
[Top][All Lists]
Advanced

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

Re: Reprise: external pager quitting kills standard error


From: Daniel J Sebald
Subject: Re: Reprise: external pager quitting kills standard error
Date: Sun, 30 Jan 2005 16:18:47 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041020

Dmitri A. Sergatskov wrote:

I am on FC3 and I cannot reproduce this problem:

octave:1> bogus
error: `bogus' undefined near line 1 column 1
octave:1> junk = ones(100)
warning: connection to external pager (pid = 26581) lost --
warning: attempting to finish pending computations...
warning: broken pipe
octave:2> bogus
error: `bogus' undefined near line 2 column 1
octave:2> junk = ones(100)
octave:3>
octave:3> bogus
error: `bogus' undefined near line 3 column 1
octave:3> junk = ones(1000)
warning: connection to external pager (pid = 26583) lost --
warning: attempting to finish pending computations...
warning: broken pipe

(I am hitting "q" after first page is displayed)


Yes "q", right. But thanks for the results because it illustrates something. I am not getting the "warning: broken pipe" complaint before the error messages are lost. This could be a sign of where the problem lies.

I'm logically sort of narrowing this down. I think it does have something to do with buffer behavior. Below is some code in pager.cc, which may be the origin of the problem (not the problem 'though). I suspect for some reason the "external_pager->good()" fails so the "// We had a pager, but it must have died" section gets run. This command "octave_set_interrupt_handler (saved_interrupt_handler);" is probably what messes things up (something to do with interrupts and synchronization, tricky stuff). However, even if it were, probably "external_pager->good()" should not have failed. [Remember, I've not tested this, just thinking it through.]

Furthermore, the external pager is a stream. And it wouldn't surprise me that when large amounts of data are put into the stream and the other end quits while there is still stuff to be pulled out, that the stream might think the external pager has died. (Does "less" pull everything out of the stream at the beginning? Or only as the cursor is advanced?)

// Our actual connection to the external pager.
static oprocstream *external_pager = 0;

Dan






     if (external_pager)
       {
         if (octave_pager_pid > 0 && external_pager->good ())
       {
         external_pager->write (msg, len);

         // These checks are needed if a signal handler
         // invoked since the last set of checks attempts
         // to flush output and then returns

         if (octave_pager_pid > 0
             && external_pager
             && external_pager->good ())
           external_pager->flush ();
       }
         else
       {
         // We had a pager, but it must have died.  Restore
         // the interrupt state so we can escape back to the
         // prompt if there are lots of computations pending.

         if (interrupt_handler_saved)
           {
             octave_set_interrupt_handler (saved_interrupt_handler);
             interrupt_handler_saved = false;
           }
       }
       }
     else
       {
         std::cout.write (msg, len);
         std::cout.flush ();
       }
   }





reply via email to

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