mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-20 20:48:43 +00:00
Fix locking of stdou
in UIThreadInner
which blocks the printing in main thread and prevents it from exiting. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
cea67b2e54
commit
ede134d851
1 changed files with 7 additions and 7 deletions
|
@ -32,14 +32,14 @@ impl UIThreadInner {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lock stdout so that nobody can interfere
|
|
||||||
// with confirmation.
|
|
||||||
let mut stdout = io::stdout().lock();
|
|
||||||
|
|
||||||
let res = loop {
|
let res = loop {
|
||||||
writeln!(&mut stdout, "Do you wish to continue? yes/[no]").unwrap();
|
{
|
||||||
write!(&mut stdout, "? ").unwrap();
|
let mut stdout = io::stdout().lock();
|
||||||
stdout.flush().unwrap();
|
|
||||||
|
writeln!(&mut stdout, "Do you wish to continue? yes/[no]").unwrap();
|
||||||
|
write!(&mut stdout, "? ").unwrap();
|
||||||
|
stdout.flush().unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
input.clear();
|
input.clear();
|
||||||
stdin.read_line(&mut input).unwrap();
|
stdin.read_line(&mut input).unwrap();
|
||||||
|
|
Loading…
Add table
Reference in a new issue