fix: correctly propagate exit codes without printing them
This commit is contained in:
+2
-3
@@ -183,9 +183,8 @@ fn main() -> Result<()> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Cleanup happens automatically via tempfile
|
// Cleanup happens automatically via tempfile
|
||||||
match &result {
|
if result.is_ok() {
|
||||||
Ok(_) => veprintln!("Cleanup complete."),
|
veprintln!("Cleanup complete.");
|
||||||
Err(e) => eprintln!("Error: {}", e),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
result
|
result
|
||||||
|
|||||||
+3
-1
@@ -224,10 +224,12 @@ where
|
|||||||
match status {
|
match status {
|
||||||
nix::sys::wait::WaitStatus::Exited(_, 0) => Ok(()),
|
nix::sys::wait::WaitStatus::Exited(_, 0) => Ok(()),
|
||||||
nix::sys::wait::WaitStatus::Exited(_, code) => {
|
nix::sys::wait::WaitStatus::Exited(_, code) => {
|
||||||
|
// If the child reported an error (e.g., setup failure), return it.
|
||||||
|
// Otherwise, just forward the exit code without an error message.
|
||||||
if let Some(msg) = child_error {
|
if let Some(msg) = child_error {
|
||||||
Err(anyhow!("{}", msg))
|
Err(anyhow!("{}", msg))
|
||||||
} else {
|
} else {
|
||||||
Err(anyhow!("Child process exited with code {}", code))
|
std::process::exit(code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nix::sys::wait::WaitStatus::Signaled(_, sig, _) => {
|
nix::sys::wait::WaitStatus::Signaled(_, sig, _) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user