MCPcopy
hub / github.com/cloudfoundry/cli / WaitForResult

Function WaitForResult

command/v7/shared/result_waiter.go:10–38  ·  view source on GitHub ↗
(stream chan v7action.PollJobEvent, ui command.UI, waitForCompletion bool)

Source from the content-addressed store, hash-verified

8)
9
10func WaitForResult(stream chan v7action.PollJobEvent, ui command.UI, waitForCompletion bool) (bool, error) {
11 if stream == nil {
12 return true, nil
13 }
14
15 if waitForCompletion {
16 fmt.Fprint(ui.Writer(), "Waiting for the operation to complete")
17
18 defer func() {
19 ui.DisplayNewline()
20 ui.DisplayNewline()
21 }()
22 }
23
24 for event := range stream {
25 ui.DisplayWarnings(event.Warnings)
26 if waitForCompletion {
27 fmt.Fprint(ui.Writer(), ".")
28 }
29 if event.Err != nil {
30 return false, event.Err
31 }
32 if event.State == v7action.JobPolling && !waitForCompletion {
33 return false, nil
34 }
35 }
36
37 return true, nil
38}

Callers 11

ExecuteMethod · 0.92
ExecuteMethod · 0.92
ExecuteMethod · 0.92
ExecuteMethod · 0.92
ExecuteMethod · 0.92
ExecuteMethod · 0.92
ExecuteMethod · 0.92
ExecuteMethod · 0.92
ExecuteMethod · 0.92
ExecuteMethod · 0.92
ExecuteMethod · 0.92

Calls 3

WriterMethod · 0.65
DisplayNewlineMethod · 0.65
DisplayWarningsMethod · 0.65

Tested by

no test coverage detected