Convert ExitStatus to use fn to get details
Instead of requiring callers to read the struct fields to check for an error, provide the exit results via a function instead which is more natural. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
@@ -60,11 +60,12 @@ var taskAttachCommand = cli.Command{
|
||||
}
|
||||
|
||||
ec := <-statusC
|
||||
if ec.Err != nil {
|
||||
code, _, err := ec.Result()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if ec.Code != 0 {
|
||||
return cli.NewExitError("", int(ec.Code))
|
||||
if code != 0 {
|
||||
return cli.NewExitError("", int(code))
|
||||
}
|
||||
return nil
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user