On Fri, Jul 16, 2010 at 07:55:32AM +0200, [email protected] wrote:
> Author: kuemmel
> Date: Fri Jul 16 07:55:31 2010
> New Revision: 34910
> URL: http://www.lyx.org/trac/changeset/34910
> 
> Log:
> only guard terminal output.
> 
> Modified:
>    lyx-devel/trunk/src/support/Systemcall.cpp
>    lyx-devel/trunk/src/support/SystemcallPrivate.h
> 
> Modified: lyx-devel/trunk/src/support/Systemcall.cpp
> ==============================================================================
> --- lyx-devel/trunk/src/support/Systemcall.cpp        Fri Jul 16 03:15:55 
> 2010        (r34909)
> +++ lyx-devel/trunk/src/support/Systemcall.cpp        Fri Jul 16 07:55:31 
> 2010        (r34910)
> @@ -241,18 +241,18 @@
>  }
>  
>  
> -SystemcallPrivate::SystemcallPrivate(const std::string& of) : 
> +SystemcallPrivate::SystemcallPrivate(const std::string& of) :
>                                  proc_(new QProcess), outindex_(0), 
> errindex_(0),
> -                                outfile(of), showout_(false), 
> showerr_(false), process_events(false)
> +                                outfile(of), 
> +                                
> terminalOutExists_(os::is_terminal(os::STDOUT)),
> +                                
> terminalErrExists_(os::is_terminal(os::STDERR)),
> +                                process_events(false)
>  {
>       if (!outfile.empty()) {
>               // Check whether we have to simply throw away the output.
>               if (outfile != os::nulldev())
>                       proc_->setStandardOutputFile(toqstr(outfile));
> -     } else if (os::is_terminal(os::STDOUT))
> -             setShowOut(true);

This is wrong. You are going to output to a terminal whenever one exists.
That was not the logic of what you changed. Output to a terminal should
be avoided when there isn't a terminal *or* when stdout is redirected
to a file. Imagine you have "pnmtopng foo.pnm > foo.png", which produces
binary output. With your change the terminal will be flooded by binary
data, possibly putting it in a strange state, because in the binary stream
something interpretable as an escape sequence may be present.

-- 
Enrico

Reply via email to