mirror of
https://github.com/restic/restic.git
synced 2024-12-23 00:07:25 +00:00
CI: return directly after an error occurred
This commit is contained in:
parent
f178cbf93d
commit
a2766ffe0c
1 changed files with 15 additions and 10 deletions
|
@ -484,16 +484,21 @@ func main() {
|
|||
os.Exit(1)
|
||||
}
|
||||
|
||||
foundError := false
|
||||
for _, f := range []func() error{env.Prepare, env.RunTests, env.Teardown} {
|
||||
err := f()
|
||||
err := env.Prepare()
|
||||
if err != nil {
|
||||
foundError = true
|
||||
fmt.Fprintf(os.Stderr, "error: %v\n", err)
|
||||
}
|
||||
}
|
||||
|
||||
if foundError {
|
||||
fmt.Fprintf(os.Stderr, "error preparing: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
err = env.RunTests()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "error running tests: %v\n", err)
|
||||
os.Exit(2)
|
||||
}
|
||||
|
||||
err = env.Teardown()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "error during teardown: %v\n", err)
|
||||
os.Exit(3)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue