diff --git a/cli/client.go b/cli/client.go index c5d614421..f31b4dcfb 100644 --- a/cli/client.go +++ b/cli/client.go @@ -1185,6 +1185,8 @@ var clientRetrieveCmd = &cli.Command{ return xerrors.Errorf("error setting up retrieval: %w", err) } + var prevStatus retrievalmarket.DealStatus + for { select { case evt, ok := <-updates: @@ -1195,6 +1197,7 @@ var clientRetrieveCmd = &cli.Command{ retrievalmarket.ClientEvents[evt.Event], retrievalmarket.DealStatuses[evt.Status], ) + prevStatus = evt.Status } if evt.Err != "" { @@ -1202,10 +1205,11 @@ var clientRetrieveCmd = &cli.Command{ } if !ok { - if evt.Status == retrievalmarket.DealStatusCompleted { + if prevStatus == retrievalmarket.DealStatusCompleted { afmt.Println("Success") } else { - afmt.Printf("saw final deal state %s instead of expected success state DealStatusCompleted", retrievalmarket.DealStatuses[evt.Status]) + afmt.Printf("saw final deal state %s instead of expected success state DealStatusCompleted", + retrievalmarket.DealStatuses[prevStatus]) } return nil }