Skip to content

fix Plot.show() #131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions plotly/src/plot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,13 @@ impl Plot {

// Save the rendered plot to the temp file.
let temp_path = temp.to_str().unwrap();
let mut file = File::create(temp_path).unwrap();
file.write_all(rendered.as_bytes())
.expect("failed to write html output");
file.flush().unwrap();

{
let mut file = File::create(temp_path).unwrap();
file.write_all(rendered.as_bytes())
.expect("failed to write html output");
file.flush().unwrap();
}

// Hand off the job of opening the browser to an OS-specific implementation.
Plot::show_with_default_app(temp_path);
Expand All @@ -288,10 +291,13 @@ impl Plot {

// Save the rendered plot to the temp file.
let temp_path = temp.to_str().unwrap();
let mut file = File::create(temp_path).unwrap();
file.write_all(rendered.as_bytes())
.expect("failed to write html output");
file.flush().unwrap();

{
let mut file = File::create(temp_path).unwrap();
file.write_all(rendered.as_bytes())
.expect("failed to write html output");
file.flush().unwrap();
}

// Hand off the job of opening the browser to an OS-specific implementation.
Plot::show_with_default_app(temp_path);
Expand Down Expand Up @@ -467,7 +473,7 @@ impl Plot {
Command::new("cmd")
.arg("/C")
.arg(format!("start {}", temp_path))
.spawn()
.output()
.expect(DEFAULT_HTML_APP_NOT_FOUND);
}
}
Expand Down