summaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs6
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)?;