Skip to content

Commit

Permalink
Merge pull request #227 from solidiquis/broken-pipe
Browse files Browse the repository at this point in the history
Don't panic when broken pipe
  • Loading branch information
solidiquis authored Aug 4, 2023
2 parents 490f7d2 + 29282b4 commit 07b7017
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 _ = writeln!(stdout(), "{output}");
}
}

#[cfg(not(debug_assertions))]
{
println!("{output}");
let _ = writeln!(stdout(), "{output}");
}

Ok(())
Expand Down

0 comments on commit 07b7017

Please sign in to comment.