tools: let oldv fail early, when git fails to do network operations or checkouts

This commit is contained in:
Delyan Angelov 2024-12-07 16:54:04 +02:00
parent e32e9f70ce
commit 11dc600561
No known key found for this signature in database
GPG key ID: 66886C0F12D595ED
2 changed files with 51 additions and 8 deletions

View file

@ -147,6 +147,20 @@ pub fn run(cmd string) string {
return ''
}
// frun runs a command, tracing its results, and returning ONLY its output, or an error, if it failed
pub fn frun(cmd string) !string {
verbose_trace_strong(modfn(@MOD, @FN), cmd)
x := os.execute(cmd)
if x.exit_code != 0 {
verbose_trace(modfn(@MOD, @FN), '## failed.')
verbose_trace(modfn(@MOD, @FN), '## failure code: ${x.exit_code}')
verbose_trace(modfn(@MOD, @FN), '## failure output: ${x.output}')
return error_with_code('failed cmd: ${cmd}', x.exit_code)
}
verbose_trace_exec_result(x)
return x.output.trim_right('\r\n')
}
pub fn exit_0_status(cmd string) bool {
verbose_trace_strong(modfn(@MOD, @FN), cmd)
x := os.execute(cmd)