func main() { s := ui.NewSpinner("Waiting...", ui.SuffixElapsed(), nil) for i := 0; i < 32; i++ { s.Step() time.Sleep(250 * time.Millisecond) } s.Finish() }
func (pod *Pod) Kill() error { pod.ui.Println("Shutting down") spin := ui.NewSpinner("Waiting for jail to die", ui.SuffixElapsed(), nil) defer spin.Finish() retry: switch status := pod.Status(); status { case PodStatusStopped: // All's fine return nil case PodStatusRunning: if err := pod.runJail("-r"); err != nil { return errors.Trace(err) } goto retry case PodStatusDying: // TODO: UI? Log? spin.Step() time.Sleep(250 * time.Millisecond) goto retry default: return errors.Errorf("Pod is %v, I am confused", status) } }