diff options
author | Sebastian Thiel <sebastian.thiel@icloud.com> | 2021-06-09 16:45:23 +0800 |
---|---|---|
committer | Sebastian Thiel <sebastian.thiel@icloud.com> | 2021-06-09 16:45:23 +0800 |
commit | a93a642765540d4010dc2fab90737cd39abaa32d (patch) | |
tree | 20282aa199956bd87dcf47efa304a346e062edb8 /src/main.rs | |
parent | 1bfcc6306739f4dfbe076acdbe53bf59143e9245 (diff) |
Show TUI on stderr to enable writing files to stdout
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs index 0596458..15a34ff 100644 --- a/src/main.rs +++ b/src/main.rs @@ -73,12 +73,12 @@ fn main() -> Result<()> { use crosstermion::terminal::{tui::new_terminal, AlternateRawScreen}; let no_tty_msg = "Interactive mode requires a connected terminal"; - if atty::isnt(atty::Stream::Stdout) { + if atty::isnt(atty::Stream::Stderr) { return Err(anyhow!(no_tty_msg)); } let mut terminal = new_terminal( - AlternateRawScreen::try_from(io::stdout()).with_context(|| no_tty_msg)?, + AlternateRawScreen::try_from(io::stderr()).with_context(|| no_tty_msg)?, ) .with_context(|| "Could not instantiate terminal")?; let res = TerminalApp::initialize( @@ -106,7 +106,7 @@ fn main() -> Result<()> { }); drop(terminal); - io::stdout().flush().ok(); + io::stderr().flush().ok(); // Exit 'quickly' to avoid having to not have to deal with slightly different types in the other match branches std::process::exit( |