Skip to content

Commit

Permalink
better trunk panic
Browse files Browse the repository at this point in the history
  • Loading branch information
fominok committed Jul 8, 2024
1 parent d9814a2 commit e1b1ef3
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions grovedb/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,28 @@ fn main() {
use std::{
env,
path::PathBuf,
process::{Command, ExitStatus},
process::{Command, ExitStatus, Output},

Check warning on line 6 in grovedb/build.rs

View workflow job for this annotation

GitHub Actions / clippy

unused import: `ExitStatus`

warning: unused import: `ExitStatus` --> grovedb/build.rs:6:28 | 6 | process::{Command, ExitStatus, Output}, | ^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default
};

let out_dir = PathBuf::from(&env::var_os("OUT_DIR").unwrap());

if !Command::new("trunk")
let Output {
status,
stdout,
stderr,
} = Command::new("trunk")
.arg("build")
.arg("--release")
.arg("--dist")
.arg(&out_dir)
.arg("grovedbg/index.html")
.status()
.as_ref()
.map(ExitStatus::success)
.unwrap_or(false)
{
panic!("Error running `trunk build --release`");
.output()
.expect("cannot start trunk process");

if !status.success() {
let stdout_msg = String::from_utf8_lossy(&stdout);
let stderr_msg = String::from_utf8_lossy(&stderr);
panic!("Error running `trunk build --release`\n{stdout_msg}\n{stderr_msg}");
}

let zip_file = out_dir.join("grovedbg.zip");
Expand Down

0 comments on commit e1b1ef3

Please sign in to comment.