Skip to content

Commit

Permalink
Merge pull request #215 from solidiquis/stdout-deadlock-fix
Browse files Browse the repository at this point in the history
Stdout deadlock fix
  • Loading branch information
solidiquis authored Jul 1, 2023
2 parents 2542e28 + 3f3195d commit a146da1
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.

This project adheres to [Semantic Versioning](http://semver.org/).

## [3.1.1] - 2023-07-01

[This patches](https://github.com/solidiquis/erdtree/pull/215) a deadlock that occurs when `--pattern` fails to make any matches and the progress indicator is enabled which causes `erdtree` to completely freeze.

## [3.1.0] - 2023-07-01

### [What's new](https://github.com/solidiquis/erdtree/pull/202)
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "erdtree"
version = "3.1.0"
version = "3.1.1"
edition = "2021"
authors = ["Benjamin Nguyen <[email protected]>"]
description = """
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ no reason to have both.

#### TOML file

`erdtree` will look for `.erdtree.toml in any of the following locations:
`erdtree` will look for `.erdtree.toml` in any of the following locations:

On Unix-systems:

Expand Down
2 changes: 1 addition & 1 deletion src/context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub mod time;
#[derive(Parser, Debug)]
#[command(name = "erdtree")]
#[command(author = "Benjamin Nguyen. <[email protected]>")]
#[command(version = "3.1.0")]
#[command(version = "3.1.1")]
#[command(about = "erdtree (erd) is a cross-platform, multi-threaded, and general purpose filesystem and disk usage utility.", long_about = None)]
pub struct Context {
/// Directory to traverse; defaults to current working directory
Expand Down
7 changes: 2 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,11 @@ mod tty;
mod utils;

fn main() -> ExitCode {
let result = run();

tty::restore_tty();

if let Err(e) = result {
if let Err(e) = run() {
eprintln!("{e}");
return ExitCode::FAILURE;
}

ExitCode::SUCCESS
}

Expand Down
4 changes: 3 additions & 1 deletion src/progress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ impl IndicatorHandle {
.transpose()?;
}
}

Ok(())
}
}
Expand All @@ -144,7 +145,7 @@ impl<'a> Indicator<'a> {
while let Ok(msg) = rx.recv() {
if prx.recv_timeout(PRIORITY_MAIL_TIMEOUT).is_ok() {
indicator.update_state(IndicatorState::Done)?;
break;
return Ok(());
}

match msg {
Expand Down Expand Up @@ -185,6 +186,7 @@ impl<'a> Indicator<'a> {
let stdout = &mut self.stdout;
stdout.execute(terminal::Clear(ClearType::CurrentLine))?;
stdout.execute(cursor::RestorePosition)?;
stdout.execute(cursor::Show)?;
},
_ => (),
}
Expand Down

0 comments on commit a146da1

Please sign in to comment.