@@ -262,10 +262,13 @@ impl Plot {
262
262
263
263
// Save the rendered plot to the temp file.
264
264
let temp_path = temp. to_str ( ) . unwrap ( ) ;
265
- let mut file = File :: create ( temp_path) . unwrap ( ) ;
266
- file. write_all ( rendered. as_bytes ( ) )
267
- . expect ( "failed to write html output" ) ;
268
- file. flush ( ) . unwrap ( ) ;
265
+
266
+ {
267
+ let mut file = File :: create ( temp_path) . unwrap ( ) ;
268
+ file. write_all ( rendered. as_bytes ( ) )
269
+ . expect ( "failed to write html output" ) ;
270
+ file. flush ( ) . unwrap ( ) ;
271
+ }
269
272
270
273
// Hand off the job of opening the browser to an OS-specific implementation.
271
274
Plot :: show_with_default_app ( temp_path) ;
@@ -288,10 +291,13 @@ impl Plot {
288
291
289
292
// Save the rendered plot to the temp file.
290
293
let temp_path = temp. to_str ( ) . unwrap ( ) ;
291
- let mut file = File :: create ( temp_path) . unwrap ( ) ;
292
- file. write_all ( rendered. as_bytes ( ) )
293
- . expect ( "failed to write html output" ) ;
294
- file. flush ( ) . unwrap ( ) ;
294
+
295
+ {
296
+ let mut file = File :: create ( temp_path) . unwrap ( ) ;
297
+ file. write_all ( rendered. as_bytes ( ) )
298
+ . expect ( "failed to write html output" ) ;
299
+ file. flush ( ) . unwrap ( ) ;
300
+ }
295
301
296
302
// Hand off the job of opening the browser to an OS-specific implementation.
297
303
Plot :: show_with_default_app ( temp_path) ;
@@ -467,7 +473,7 @@ impl Plot {
467
473
Command :: new ( "cmd" )
468
474
. arg ( "/C" )
469
475
. arg ( format ! ( "start {}" , temp_path) )
470
- . spawn ( )
476
+ . output ( )
471
477
. expect ( DEFAULT_HTML_APP_NOT_FOUND ) ;
472
478
}
473
479
}
0 commit comments