Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stdout deadlock fix #215

Merged
merged 3 commits into from
Jul 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <benjamin.van.nguyen@gmail.com>"]
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. <benjamin.van.nguyen@gmail.com>")]
#[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