@@ -198,7 +198,10 @@ impl Kaleido {
198198 "--disable-software-rasterizer" ,
199199 "--single-process" ,
200200 "--disable-gpu" ,
201- "--timeout 2000" ,
201+ "--no-sandbox" ,
202+ "--allow-silent-push" ,
203+ "-allow-third-party-modules" ,
204+ "--allow-running-insecure-content" ,
202205 ] )
203206 . stdin ( Stdio :: piped ( ) )
204207 . stdout ( Stdio :: piped ( ) )
@@ -227,16 +230,29 @@ impl Kaleido {
227230 let output_lines = BufReader :: new ( process. stdout . take ( ) . unwrap ( ) ) . lines ( ) ;
228231 for line in output_lines. map_while ( Result :: ok) {
229232 let res = KaleidoResult :: from ( line. as_str ( ) ) ;
230- if let Some ( image_data) = res. result {
231- // TODO: this should be refactored
232- // The assumption is that KaleidoResult contains a single image.
233- // We should end the loop on the first valid one.
234- // If that is not the case, prior implementation would have returned the last
235- // valid image
236- return Ok ( image_data) ;
233+ match res. result {
234+ Some ( image_data) => {
235+ // TODO: this should be refactored
236+ // The assumption is that KaleidoResult contains a single image.
237+ // We should end the loop on the first valid one.
238+ // If that is not the case, prior implementation would have returned the last
239+ // valid image
240+ return Ok ( image_data) ;
241+ }
242+ None => {
243+ println ! ( "empty line from Kaleido" ) ;
244+ }
237245 }
238246 }
239247
248+ // Don't eat up Kaleido/Chromiu erros but show them in the terminal
249+ let stderr = process. stderr . take ( ) . unwrap ( ) ;
250+ let stderr_lines = BufReader :: new ( stderr) . lines ( ) ;
251+ for line in stderr_lines {
252+ let line = line. unwrap ( ) ;
253+ eprintln ! ( "{}" , line) ;
254+ }
255+
240256 Ok ( String :: default ( ) )
241257 }
242258}
@@ -355,18 +371,18 @@ mod tests {
355371 let dst = PathBuf :: from ( "example.pdf" ) ;
356372 let r = k. save ( dst. as_path ( ) , & test_plot, "pdf" , 1200 , 900 , 4.5 ) ;
357373 assert ! ( r. is_ok( ) ) ;
358- assert ! ( std:: fs:: remove_file( dst. as_path( ) ) . is_ok( ) ) ;
374+ // assert!(std::fs::remove_file(dst.as_path()).is_ok());
359375 }
360376
361377 // This generates empty eps files for some reason
362378 #[ test]
363- #[ ignore]
379+ // #[ignore]
364380 fn test_save_eps ( ) {
365381 let test_plot = create_test_plot ( ) ;
366382 let k = Kaleido :: new ( ) ;
367383 let dst = PathBuf :: from ( "example.eps" ) ;
368384 let r = k. save ( dst. as_path ( ) , & test_plot, "eps" , 1200 , 900 , 4.5 ) ;
369385 assert ! ( r. is_ok( ) ) ;
370- assert ! ( std:: fs:: remove_file( dst. as_path( ) ) . is_ok( ) ) ;
386+ // assert!(std::fs::remove_file(dst.as_path()).is_ok());
371387 }
372388}
0 commit comments