Always use stdout via output proxy

The switching between stdout and stderr on an automated basis caused
errors in the using code, where output was redirected but shouldn't.
This commit is contained in:
Matthias Beyer 2018-04-18 17:56:09 +02:00
parent 542c7e7101
commit 38726c5906

View file

@ -52,8 +52,6 @@ pub struct Runtime<'a> {
configuration: Option<Value>, configuration: Option<Value>,
cli_matches: ArgMatches<'a>, cli_matches: ArgMatches<'a>,
store: Store, store: Store,
stdin_is_tty: bool,
stdout_is_tty: bool,
} }
impl<'a> Runtime<'a> { impl<'a> Runtime<'a> {
@ -144,8 +142,6 @@ impl<'a> Runtime<'a> {
configuration: config, configuration: config,
rtp: rtp, rtp: rtp,
store: store, store: store,
stdout_is_tty: ::atty::is(::atty::Stream::Stdout),
stdin_is_tty: ::atty::is(::atty::Stream::Stdin),
} }
}) })
.chain_err(|| RuntimeErrorKind::Instantiate) .chain_err(|| RuntimeErrorKind::Instantiate)
@ -445,11 +441,7 @@ impl<'a> Runtime<'a> {
} }
pub fn stdout(&self) -> OutputProxy { pub fn stdout(&self) -> OutputProxy {
if self.stdout_is_tty { OutputProxy::Out(::std::io::stdout())
OutputProxy::Out(::std::io::stdout())
} else {
OutputProxy::Err(::std::io::stderr())
}
} }
pub fn stderr(&self) -> OutputProxy { pub fn stderr(&self) -> OutputProxy {