Skip to content

Commit

Permalink
don't panic when broken pipe
Browse files Browse the repository at this point in the history
  • Loading branch information
solidiquis committed Jul 4, 2023
1 parent 202fae1 commit 36cb7e0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ use clap::CommandFactory;
use context::{layout, Context};
use progress::{Indicator, IndicatorHandle, Message};
use render::{Engine, Flat, FlatInverted, Inverted, Regular};
use std::{error::Error, io::stdout, process::ExitCode};
use std::{
error::Error,
io::{stdout, Write},
process::ExitCode,
};
use tree::Tree;

/// Operations to wrangle ANSI escaped strings.
Expand Down Expand Up @@ -114,13 +118,13 @@ fn run() -> Result<(), Box<dyn Error>> {
#[cfg(debug_assertions)]
{
if std::env::var_os("ERDTREE_DEBUG").is_none() {
println!("{output}");
let _ = stdout().write(output.as_bytes());
}
}

#[cfg(not(debug_assertions))]
{
println!("{output}");
let _ = stdout().write(output.as_bytes());
}

Ok(())
Expand Down

0 comments on commit 36cb7e0

Please sign in to comment.