mirror of
https://git.aramjonghu.dev/AramJonghu/rustlings.git
synced 2026-09-05 01:33:30 +02:00
Use the thread builder and handle the spawn error
This commit is contained in:
+4
-2
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user