On Thu, Jul 15, 2010 at 04:31:26PM +0200, Stephan Witt wrote:
> Am 15.07.2010 um 15:53 schrieb Pavel Sanda:
> 
> > Stephan Witt wrote:
> >>>> I see in the constructor SystemcallPrivate::SystemcallPrivate 
> >>>> (SystemCall.cpp)
> >>>> the error output of the child process is collected only if it's going to 
> >>>> an terminal.
> >>>> I think it would be better to collect it unconditionally to show it in 
> >>>> the message window.
> >>>> What do others think?
> >>> 
> >>> whats the point of collecting it if we are not going to show it?
> >> 
> >> The point is that you can read it when looking for it in the message 
> >> window.
> >> That's currently not possible, the error messages are lost.
> >> 
> >> Here on Mac if I start LyX the stdin, stdout and stderr are redirected on 
> >> startup.
> >> 
> >> If I remove the os::is_terminal(os::STDERR) test the output becomes 
> >> visible.
> >> 
> >> Another story is to show the errors in the alert popup. This can be 
> >> improved too.
> > 
> > i'm not sure what are side effects of kicking out 
> > os::is_terminal(os::STDERR) tests.
> > when i shortly peeked to sources it seems to be little bit messy how we mix 
> > variables
> > which govern whether we ouput err messages on console and on window.
> > the right thing might be to fix this than to remove the tests...
> 
> Maybe. But I think to remove the check is a linear improvement and more I 
> cannot do for now.
> I don't say the next step shouldn't be done. But I cannot afford two steps 
> currently.
> Of course I can guard the change with an #ifdef ON_MAC but that's really ugly.
> 
> Perhaps Enrico and Peter - the authors - can have a look...

I had a quick look. Removing os::is_terminal(os::STDERR) is not the
right thing to do. I introduced that check for not outputting anything
when a terminal is not connected. Then Peter coupled the output to a
terminal with the output sent to the GUI, such that if no output should
go to a terminal (because there is no terminal), no output is sent to
the GUI, too, which seems wrong.

IMO, the correct fix is changing all occurences of

    if (showerr_) {
            cerr << errdata_;
            ProgressInterface::instance()->appendError...
    }

to

    if (showerr_)
            cerr << errdata_;
    ProgressInterface::instance()->appendError...

and similarly for other cases. In this way, output meant to go to a
terminal and output meant for the GUI gets decoupled. However, I only
had a very quick look, so I could be missing something. I think it is
better that Peter has a look.

-- 
Enrico

Reply via email to