cmd: fix run list panic on task with nil exit status

Fux run list panic on task with nil exit status.
It may happen that a finished task doesn't have an exit status.
This commit is contained in:
Simone Gotti 2022-02-23 15:21:55 +01:00
parent c24d2d014d
commit f8bce8a8dc
1 changed files with 1 additions and 1 deletions

View File

@ -83,7 +83,7 @@ func printRuns(runs []*runDetails) {
fmt.Printf("\t\tfailed to retrieve task information: %v\n", task.retrieveError) fmt.Printf("\t\tfailed to retrieve task information: %v\n", task.retrieveError)
} else { } else {
for n, step := range task.runTaskResponse.Steps { for n, step := range task.runTaskResponse.Steps {
if step.Phase.IsFinished() && step.Type == "run" { if step.Phase.IsFinished() && step.Type == "run" && step.ExitStatus != nil {
fmt.Printf("\t\tStep: %d, Name: %s, Type: %s, Phase: %s, ExitStatus: %d\n", n, step.Name, step.Type, step.Phase, *step.ExitStatus) fmt.Printf("\t\tStep: %d, Name: %s, Type: %s, Phase: %s, ExitStatus: %d\n", n, step.Name, step.Type, step.Phase, *step.ExitStatus)
} else { } else {
fmt.Printf("\t\tStep: %d, Name: %s, Type: %s, Phase: %s\n", n, step.Name, step.Type, step.Phase) fmt.Printf("\t\tStep: %d, Name: %s, Type: %s, Phase: %s\n", n, step.Name, step.Type, step.Phase)