mirror of
https://github.com/docker/compose.git
synced 2025-07-27 15:44:08 +02:00
Merge pull request #1494 from gtardif/cancel_docker_cli_metrics
Track cancel exit code from docker cli shellout to report correct status in metrics
This commit is contained in:
commit
bd5c188be6
@ -66,11 +66,16 @@ func Exec(root *cobra.Command) {
|
|||||||
err := RunDocker(childExit, os.Args[1:]...)
|
err := RunDocker(childExit, os.Args[1:]...)
|
||||||
childExit <- true
|
childExit <- true
|
||||||
if err != nil {
|
if err != nil {
|
||||||
metrics.Track(store.DefaultContextType, os.Args[1:], metrics.FailureStatus)
|
|
||||||
|
|
||||||
if exiterr, ok := err.(*exec.ExitError); ok {
|
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())
|
os.Exit(exiterr.ExitCode())
|
||||||
}
|
}
|
||||||
|
metrics.Track(store.DefaultContextType, os.Args[1:], metrics.FailureStatus)
|
||||||
fmt.Fprintln(os.Stderr, err)
|
fmt.Fprintln(os.Stderr, err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user