Skip to content

Commit

Permalink
Do not crash on thread spawn error
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysd authored and Detegr committed May 24, 2024
1 parent 56898cd commit b543abe
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,7 @@ where
F: FnMut() + 'static + Send,
{
unsafe {
match platform::init_os_handler(overwrite) {
Ok(_) => {}
Err(err) => {
return Err(err.into());
}
}
platform::init_os_handler(overwrite)?;
}

thread::Builder::new()
Expand All @@ -147,7 +142,7 @@ where
}
user_handler();
})
.expect("failed to spawn thread");
.map_err(Error::System)?;

Ok(())
}

0 comments on commit b543abe

Please sign in to comment.