Bugfix: Fix cli occasionally not printing results (#3509)
This commit is contained in:
parent
b71f4d1d94
commit
6782b8000a
1 changed files with 5 additions and 1 deletions
|
@ -153,7 +153,7 @@ pub async fn init(
|
|||
|
||||
// Set up the print job
|
||||
let (tx, rx) = mpsc::unbounded();
|
||||
tokio::spawn(printer(rx));
|
||||
let print_task = tokio::spawn(printer(rx));
|
||||
|
||||
// Loop over each command-line input
|
||||
loop {
|
||||
|
@ -246,6 +246,10 @@ pub async fn init(
|
|||
}
|
||||
}
|
||||
}
|
||||
// drop the printer channel so the printer task will quit.
|
||||
std::mem::drop(tx);
|
||||
// print task shouldn't panic or be cancelled so this unwrap should never trigger.
|
||||
print_task.await.unwrap();
|
||||
// Save the inputs to the history
|
||||
let _ = rl.save_history("history.txt");
|
||||
// Everything OK
|
||||
|
|
Loading…
Reference in a new issue