Retrieve compose failure category by exit code

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof 2021-04-15 14:19:59 +02:00
parent d8aa00a766
commit db38d1244c
No known key found for this signature in database
GPG key ID: 9858809D6F8F6E7E
5 changed files with 29 additions and 10 deletions

View file

@ -68,12 +68,8 @@ func Exec(root *cobra.Command) {
if err != nil {
if exiterr, ok := err.(*exec.ExitError); ok {
exitCode := exiterr.ExitCode()
if exitCode == 130 {
metrics.Track(store.DefaultContextType, os.Args[1:], metrics.CanceledStatus)
} else {
metrics.Track(store.DefaultContextType, os.Args[1:], metrics.FailureStatus)
}
os.Exit(exiterr.ExitCode())
metrics.Track(store.DefaultContextType, os.Args[1:], metrics.ByExitCode(exitCode).MetricsStatus)
os.Exit(exitCode)
}
metrics.Track(store.DefaultContextType, os.Args[1:], metrics.FailureStatus)
fmt.Fprintln(os.Stderr, err)