Skip to content

Commit fc392b7

Browse files
committed
fix stdout deadlock
1 parent 2542e28 commit fc392b7

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/main.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,11 @@ mod tty;
6464
mod utils;
6565

6666
fn main() -> ExitCode {
67-
let result = run();
68-
69-
tty::restore_tty();
70-
71-
if let Err(e) = result {
67+
if let Err(e) = run() {
7268
eprintln!("{e}");
7369
return ExitCode::FAILURE;
7470
}
71+
7572
ExitCode::SUCCESS
7673
}
7774

src/progress.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ impl IndicatorHandle {
123123
.transpose()?;
124124
}
125125
}
126+
126127
Ok(())
127128
}
128129
}
@@ -144,7 +145,7 @@ impl<'a> Indicator<'a> {
144145
while let Ok(msg) = rx.recv() {
145146
if prx.recv_timeout(PRIORITY_MAIL_TIMEOUT).is_ok() {
146147
indicator.update_state(IndicatorState::Done)?;
147-
break;
148+
return Ok(());
148149
}
149150

150151
match msg {
@@ -185,6 +186,7 @@ impl<'a> Indicator<'a> {
185186
let stdout = &mut self.stdout;
186187
stdout.execute(terminal::Clear(ClearType::CurrentLine))?;
187188
stdout.execute(cursor::RestorePosition)?;
189+
stdout.execute(cursor::Show)?;
188190
},
189191
_ => (),
190192
}

0 commit comments

Comments
 (0)