Skip to content

Commit

Permalink
try one more time on macos
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei Gherghescu <[email protected]>
  • Loading branch information
andrei-ng committed Dec 20, 2024
1 parent 285036a commit 396d6ef
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
8 changes: 4 additions & 4 deletions plotly/src/plot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ mod tests {
assert!(!dst.exists());
}

#[cfg(not(target_os = "macos"))]
// #[cfg(not(target_os = "macos"))]
#[test]
#[cfg(feature = "kaleido")]
fn test_save_to_jpeg() {
Expand All @@ -773,7 +773,7 @@ mod tests {
assert!(!dst.exists());
}

#[cfg(not(target_os = "macos"))]
// #[cfg(not(target_os = "macos"))]
#[test]
#[cfg(feature = "kaleido")]
fn test_save_to_svg() {
Expand Down Expand Up @@ -822,7 +822,7 @@ mod tests {
}

#[test]
#[ignore] // Fails in the CI
// #[ignore] // Fails in the CI
#[cfg(not(target_os = "macos"))]
#[cfg(feature = "kaleido")]
fn test_image_to_base64() {
Expand Down Expand Up @@ -851,7 +851,7 @@ mod tests {
}

#[test]
#[ignore] // Fails in the CI
// #[ignore] // Fails in the CI
#[cfg(not(target_os = "macos"))]
#[cfg(feature = "kaleido")]
fn test_image_to_svg_string() {
Expand Down
29 changes: 21 additions & 8 deletions plotly_kaleido/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ impl Kaleido {
"--disable-software-rasterizer",
"--single-process",
"--disable-gpu",
"--timeout 2000",
"--no-sandbox",
])
.stdin(Stdio::piped())
.stdout(Stdio::piped())
Expand Down Expand Up @@ -227,16 +227,29 @@ impl Kaleido {
let output_lines = BufReader::new(process.stdout.take().unwrap()).lines();
for line in output_lines.map_while(Result::ok) {
let res = KaleidoResult::from(line.as_str());
if let Some(image_data) = res.result {
// TODO: this should be refactored
// The assumption is that KaleidoResult contains a single image.
// We should end the loop on the first valid one.
// If that is not the case, prior implementation would have returned the last
// valid image
return Ok(image_data);
match res.result {
Some(image_data) => {
// TODO: this should be refactored
// The assumption is that KaleidoResult contains a single image.
// We should end the loop on the first valid one.
// If that is not the case, prior implementation would have returned the last
// valid image
return Ok(image_data);
}
None => {
println!("empty line from Kaleido");
}
}
}

// Don't eat up Kaleido/Chromiu erros but show them in the terminal
let stderr = process.stderr.take().unwrap();
let stderr_lines = BufReader::new(stderr).lines();
for line in stderr_lines {
let line = line.unwrap();
eprintln!("{}", line);
}

Ok(String::default())
}
}
Expand Down

0 comments on commit 396d6ef

Please sign in to comment.