Skip to content

Commit

Permalink
in_place_scope allows thread to finish without the need to join
Browse files Browse the repository at this point in the history
  • Loading branch information
kimono-koans committed Apr 13, 2023
1 parent 1ae10cb commit 123845b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/exec/interactive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ impl InteractiveBrowse {
let (hangup_tx, hangup_rx): (Sender<Never>, Receiver<Never>) = bounded(0);

// thread spawn fn enumerate_directory - permits recursion into dirs without blocking
let background_handle = thread::spawn(move || {
// let background_handle =
thread::spawn(move || {
// no way to propagate error from closure so exit and explain error here
RecursiveSearch::exec(&requested_dir_clone, tx_item.clone(), hangup_rx.clone())
});
Expand Down Expand Up @@ -148,9 +149,9 @@ impl InteractiveBrowse {
Ok(output)
});

background_handle
.join()
.map_err(|_err| HttmError::new("Background browse thread panicked."))?;
// background_handle
// .join()
// .map_err(|_err| HttmError::new("Background browse thread panicked."))?;

display_handle.join().unwrap_or(Err(
HttmError::new("Interactive browse thread panicked.").into()
Expand Down

0 comments on commit 123845b

Please sign in to comment.