Skip to content

Commit b484872

Browse files
committed
process::exit if the HapticsWorker dies
1 parent bcb0194 commit b484872

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Diff for: src/dial_device/haptics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl DialHapticsWorker {
5858
eprintln!("haptics worker is ready");
5959

6060
let api = HidApi::new().map_err(Error::HidError)?;
61-
let hid_device = api.open(0x045e, 0x091b).map_err(|_| Error::MissingDial)?;
61+
let hid_device = api.open(0x045e, 0x091b).map_err(Error::HidError)?;
6262
let wrapper = DialHidWrapper { hid_device };
6363

6464
loop {

Diff for: src/dial_device/mod.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,12 @@ impl DialDevice {
6969
std::thread::spawn({
7070
let mut worker = DialHapticsWorker::new(haptics_msg_rx)?;
7171
move || {
72-
worker.run().unwrap();
72+
if let Err(err) = worker.run() {
73+
eprintln!("Unexpected haptics worker error! {}", err);
74+
}
7375
eprintln!("the haptics worker died!");
76+
// there's no coming back from this.
77+
std::process::exit(0);
7478
}
7579
});
7680

0 commit comments

Comments
 (0)