On Fri, Jul 16, 2010 at 11:31:02AM +0200, Peter Kümmel wrote:
> Enrico Forestieri wrote:
> >>> ///
> >>> - bool showerr_;
> >>> + bool terminalOutExists_;
> >> terminal_out_exists_
> >
> > stdout_exists_
>
> Hope attached patch makes the code more readable.
Yes, I think so, but see below.
> But why do we ignore the terminal settings in flush() ?
What do you mean?
> Index: Systemcall.cpp
> ===================================================================
> --- Systemcall.cpp (Revision 34914)
> +++ Systemcall.cpp (Arbeitskopie)
> @@ -246,16 +246,24 @@
> out_index_(0),
> err_index_(0),
> out_file_(of),
> -
> terminal_out_exists_(os::is_terminal(os::STDOUT)),
> -
> terminal_err_exists_(os::is_terminal(os::STDERR)),
> + use_stdout_(false),
> + use_stderr_(false),
We can avoid initializing these two, given the change below.
> process_events_(false)
> {
> if (!out_file_.empty()) {
> + // Don't output to terminal if stdout is redirected
> + use_stdout_ = false;
> // Check whether we have to simply throw away the output.
> if (out_file_ != os::nulldev())
> process_->setStandardOutputFile(toqstr(out_file_));
> + } else if (os::is_terminal(os::STDOUT)) {
> + // Output to terminal if stdout exists and is not redirected
> + use_stdout_ = true;
} else {
// Output to terminal if stdout exists and is not redirected
use_stdout_ = os::is_terminal(os::STDOUT);
--
Enrico