Watch
0
0
Fork
You've already forked hyperhive
0

overlay config .git only when the source has one; record a failed start in the op output

This commit is contained in:
atlas 2026-11-01 12:17:31 +01:00 • committed by mara
commit 23b0c4cd55

View file

@ -801,6 +801,21 @@ fn make_log_callback(
}
}
/// Put a failed non-streaming op's error into its build-log row, which has no
/// other output: `start` runs through `call`, not the streaming protocol. The
/// error carries `nixos-container`'s stderr.
fn record_failure(
logs: Option<&crate::build_logs::BuildLogs>,
log_id: Option<i64>,
err: &anyhow::Error,
) {
if let (Some(h), Some(id)) = (logs, log_id) {
for line in format!("{err:#}").lines() {
h.append_stderr(id, line);
}
}
}
/// A `create` or `update` asked for without a closure. The
/// public entry points take the closure, so this guards the string dispatch
/// below only.
@ -867,7 +882,13 @@ async fn priv_run_inner(
}
None => Err(missing_toplevel(kind, name)),
},
"start" => crate::priv_client::start_container(name).await,
"start" => {
let started = crate::priv_client::start_container(name).await;
if let Err(e) = &started {
record_failure(logs.as_deref(), log_id, e);
}
started
}
"stop" => crate::priv_client::stop_container(name).await,
"kill" => crate::priv_client::kill_container(name).await,
"destroy" => crate::priv_client::destroy_container(name).await,