diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2023-10-19 20:41:58 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2023-10-19 20:41:58 -0400 |
commit | 8147262c1cc069d095e207b56d3d8e4ef4386a09 (patch) | |
tree | 66e0db943c870db3cc3ff4d477ecc4d48e92e4ca /src | |
parent | d43d85d258f8125d67ec3beb8389ca531b1bc280 (diff) | |
download | kd-forest-8147262c1cc069d095e207b56d3d8e4ef4386a09.tar.xz |
Update some deps
Diffstat (limited to 'src')
-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 9107079..c651b23 100644 --- a/src/main.rs +++ b/src/main.rs @@ -21,7 +21,7 @@ use rand_pcg::Pcg64; use std::cmp; use std::error::Error; -use std::io::{self, BufWriter, Write}; +use std::io::{self, BufWriter, IsTerminal, Write}; use std::path::PathBuf; use std::process::exit; use std::str::FromStr; @@ -383,13 +383,13 @@ impl App { } fn write_frame(image: &RgbaImage) -> AppResult<()> { - if atty::is(atty::Stream::Stdout) { + let stdout = io::stdout(); + if stdout.is_terminal() { return Err(AppError::invalid_value( "Not writing images to your terminal, please pipe the output somewhere" )); } - let stdout = io::stdout(); let writer = BufWriter::new(stdout.lock()); let encoder = PngEncoder::new_with_quality(writer, CompressionType::Rle, FilterType::NoFilter); encoder.encode(image, image.width(), image.height(), ColorType::Rgba8)?; |