mirror of
https://codeberg.org/icewind/haze.git
synced 2026-06-04 01:24:09 +02:00
proper exit code for test
This commit is contained in:
parent
2bc9e571d2
commit
c734dede0e
2 changed files with 12 additions and 4 deletions
|
|
@ -234,3 +234,10 @@ impl From<i64> for ExitCode {
|
||||||
ExitCode(code)
|
ExitCode(code)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<ExitCode> for std::process::ExitCode {
|
||||||
|
fn from(value: ExitCode) -> Self {
|
||||||
|
let code = u8::try_from(value.0).unwrap_or(1);
|
||||||
|
code.into()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ use miette::{IntoDiagnostic, Report, Result, WrapErr};
|
||||||
use std::env::vars;
|
use std::env::vars;
|
||||||
use std::io::stdout;
|
use std::io::stdout;
|
||||||
use std::os::unix::process::CommandExt;
|
use std::os::unix::process::CommandExt;
|
||||||
use std::process::Command;
|
use std::process::{Command, ExitCode};
|
||||||
|
|
||||||
mod args;
|
mod args;
|
||||||
mod cloud;
|
mod cloud;
|
||||||
|
|
@ -46,7 +46,7 @@ fn get_forward_env() -> Vec<String> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<()> {
|
async fn main() -> Result<ExitCode> {
|
||||||
miette::set_panic_hook();
|
miette::set_panic_hook();
|
||||||
tracing_subscriber::fmt::init();
|
tracing_subscriber::fmt::init();
|
||||||
|
|
||||||
|
|
@ -216,8 +216,9 @@ async fn main() -> Result<()> {
|
||||||
cloud.enable_app(&docker, app).await?;
|
cloud.enable_app(&docker, app).await?;
|
||||||
}
|
}
|
||||||
args.insert(0, "tests".to_string());
|
args.insert(0, "tests".to_string());
|
||||||
cloud.exec(&docker, args, false, get_forward_env()).await?;
|
let result = cloud.exec(&docker, args, false, get_forward_env()).await?;
|
||||||
cloud.destroy(&docker).await?;
|
cloud.destroy(&docker).await?;
|
||||||
|
return Ok(result.into());
|
||||||
}
|
}
|
||||||
HazeArgs::Integration { options, mut args } => {
|
HazeArgs::Integration { options, mut args } => {
|
||||||
let cloud = Cloud::create(&docker, options, &config).await?;
|
let cloud = Cloud::create(&docker, options, &config).await?;
|
||||||
|
|
@ -377,7 +378,7 @@ async fn main() -> Result<()> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(())
|
Ok(ExitCode::SUCCESS)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn setup(docker: &Docker, options: CloudOptions, config: &HazeConfig) -> Result<Cloud> {
|
async fn setup(docker: &Docker, options: CloudOptions, config: &HazeConfig) -> Result<Cloud> {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue