Propagate tokio runtime creation failure in graphene-cli

This commit is contained in:
Dennis Kobert
2026-08-02 19:29:33 +02:00
parent 167d733f02
commit 2b3161773f
+3 -3
View File
@@ -31,8 +31,8 @@ impl NodeGraphUpdateSender for UpdateLogger {
struct TokioSpawner(Option<tokio::runtime::Runtime>); struct TokioSpawner(Option<tokio::runtime::Runtime>);
impl TokioSpawner { impl TokioSpawner {
fn new() -> Self { fn new() -> Result<Self, std::io::Error> {
Self(Some(tokio::runtime::Runtime::new().expect("Failed to start the async source runtime"))) Ok(Self(Some(tokio::runtime::Runtime::new()?)))
} }
} }
@@ -202,7 +202,7 @@ fn main() -> Result<(), Box<dyn Error>> {
let preferences = EditorPreferences { let preferences = EditorPreferences {
max_render_region_size: EditorPreferences::default().max_render_region_size, max_render_region_size: EditorPreferences::default().max_render_region_size,
}; };
let graph_runtime: Arc<DynGraphRuntime> = Arc::new(GraphRuntime::new(Box::new(TokioSpawner::new()) as Box<DynSpawner>)); let graph_runtime: Arc<DynGraphRuntime> = Arc::new(GraphRuntime::new(Box::new(TokioSpawner::new()?) as Box<DynSpawner>));
let (completion_sender, completion_receiver) = std::sync::mpsc::channel(); let (completion_sender, completion_receiver) = std::sync::mpsc::channel();
graph_runtime.set_notifier(Arc::new(move || { graph_runtime.set_notifier(Arc::new(move || {
let _ = completion_sender.send(()); let _ = completion_sender.send(());