fix(git): make sure we always fail on exit code != 0
Some checks reported errors
continuous-integration/drone/push Build was killed
continuous-integration/drone Build is passing

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
Kasper Juul Hermansen 2023-08-12 21:48:18 +02:00
parent 675947ed1e
commit 51ca73a53b
Signed by: kjuulh
GPG Key ID: 9AA7BC13CE474394

View File

@ -79,6 +79,13 @@ impl VcsClient {
let stdout = std::str::from_utf8(&checkout_branch.stdout)?; let stdout = std::str::from_utf8(&checkout_branch.stdout)?;
let stderr = std::str::from_utf8(&checkout_branch.stderr)?; let stderr = std::str::from_utf8(&checkout_branch.stderr)?;
tracing::debug!(stdout = stdout, stderr = stderr, "git {}", args.join(" ")); tracing::debug!(stdout = stdout, stderr = stderr, "git {}", args.join(" "));
let exit_code = checkout_branch.status;
if !exit_code.success() {
anyhow::bail!(
"failed to run git command: {}",
exit_code.code().unwrap_or(-1)
)
}
} }
} }