tikz-gallery-generator

Custum build of stapix for tikz.pablopie.xyz

Commit
3986bf768f93d2f74211203d475f00aa14666850
Parent
e54035f0f5f55ef3a1553a722efd08125c9d8ec6
Author
Pablo <pablo-pie@riseup.net>
Date

Improved some error handling

Added code for handling potential panics in the rendering threads

Pulling changes from upstream

Diffstat

1 file changed, 9 insertions, 3 deletions

Status File Name N° Changes Insertions Deletions
Modified src/main.rs 12 9 3
diff --git a/src/main.rs b/src/main.rs
@@ -135,9 +135,15 @@ fn render_gallery(pics: Vec<GalleryEntry>) -> ExitCode {
         });
     }
 
-    for msg in reciever.iter().take(pics.len()) {
-        if !msg {
-            return ExitCode::FAILURE;
+    for _ in 0..pics.len() {
+        match reciever.recv() {
+            Ok(false) => return ExitCode::FAILURE,
+            Ok(true)  => {}
+            Err(_)    => {
+                // Propagate the panic to the main thread: reciever.recv should
+                // only fail if some of the rendering threads panicked
+                panic!("rendering thread panicked!");
+            }
         }
     }