Esempio n. 1
0
func main() {
	s := ui.NewSpinner("Waiting...", ui.SuffixElapsed(), nil)
	for i := 0; i < 32; i++ {
		s.Step()
		time.Sleep(250 * time.Millisecond)
	}
	s.Finish()
}
Esempio n. 2
0
File: pod.go Progetto: saper/jetpack
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)
	}
}