@@ -198,7 +198,10 @@ impl Kaleido {
198
198
"--disable-software-rasterizer" ,
199
199
"--single-process" ,
200
200
"--disable-gpu" ,
201
- "--timeout 2000" ,
201
+ "--no-sandbox" ,
202
+ "--allow-silent-push" ,
203
+ "-allow-third-party-modules" ,
204
+ "--allow-running-insecure-content" ,
202
205
] )
203
206
. stdin ( Stdio :: piped ( ) )
204
207
. stdout ( Stdio :: piped ( ) )
@@ -227,16 +230,29 @@ impl Kaleido {
227
230
let output_lines = BufReader :: new ( process. stdout . take ( ) . unwrap ( ) ) . lines ( ) ;
228
231
for line in output_lines. map_while ( Result :: ok) {
229
232
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
+ }
237
245
}
238
246
}
239
247
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
+
240
256
Ok ( String :: default ( ) )
241
257
}
242
258
}
@@ -355,18 +371,18 @@ mod tests {
355
371
let dst = PathBuf :: from ( "example.pdf" ) ;
356
372
let r = k. save ( dst. as_path ( ) , & test_plot, "pdf" , 1200 , 900 , 4.5 ) ;
357
373
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());
359
375
}
360
376
361
377
// This generates empty eps files for some reason
362
378
#[ test]
363
- #[ ignore]
379
+ // #[ignore]
364
380
fn test_save_eps ( ) {
365
381
let test_plot = create_test_plot ( ) ;
366
382
let k = Kaleido :: new ( ) ;
367
383
let dst = PathBuf :: from ( "example.eps" ) ;
368
384
let r = k. save ( dst. as_path ( ) , & test_plot, "eps" , 1200 , 900 , 4.5 ) ;
369
385
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());
371
387
}
372
388
}
0 commit comments