Skip to content

Commit ffe10a0

Browse files
authored
fix Plot.show()
Closes #128
1 parent bec81a3 commit ffe10a0

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

plotly/src/plot.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -288,10 +288,13 @@ impl Plot {
288288

289289
// Save the rendered plot to the temp file.
290290
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();
291+
292+
{
293+
let mut file = File::create(temp_path).unwrap();
294+
file.write_all(rendered.as_bytes())
295+
.expect("failed to write html output");
296+
file.flush().unwrap();
297+
}
295298

296299
// Hand off the job of opening the browser to an OS-specific implementation.
297300
Plot::show_with_default_app(temp_path);
@@ -467,7 +470,7 @@ impl Plot {
467470
Command::new("cmd")
468471
.arg("/C")
469472
.arg(format!("start {}", temp_path))
470-
.spawn()
473+
.output()
471474
.expect(DEFAULT_HTML_APP_NOT_FOUND);
472475
}
473476
}

0 commit comments

Comments
 (0)