diff options
| author | mo8it <mo8it@proton.me> | 2024-09-06 15:40:25 +0200 |
|---|---|---|
| committer | mo8it <mo8it@proton.me> | 2024-09-06 15:40:25 +0200 |
| commit | 2d26358602fc1cd0a026f634b38c34e7b4618cc9 (patch) | |
| tree | 423b6efab39073fcf8d4021374fa87c15c2a0f01 /src/watch.rs | |
| parent | 9faa5d3aa48f7a94ed87e61ad6ea659579f1311a (diff) | |
Use the thread builder and handle the spawn error
Diffstat (limited to 'src/watch.rs')
| -rw-r--r-- | src/watch.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/watch.rs b/src/watch.rs index 900eba7..a44b565 100644 --- a/src/watch.rs +++ b/src/watch.rs @@ -1,4 +1,4 @@ -use anyhow::{Error, Result}; +use anyhow::{Context, Error, Result}; use notify_debouncer_mini::{ new_debouncer, notify::{self, RecursiveMode}, @@ -77,7 +77,9 @@ fn run_watch( let mut stdout = io::stdout().lock(); watch_state.run_current_exercise(&mut stdout)?; - thread::spawn(move || terminal_event_handler(tx, manual_run)); + thread::Builder::new() + .spawn(move || terminal_event_handler(tx, manual_run)) + .context("Failed to spawn a thread to handle terminal events")?; while let Ok(event) = rx.recv() { match event { |
