Пример #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()
}
Пример #2
0
func (c *Pod) Kill() error {
	c.ui.Println("Shutting down")
	spin := ui.NewSpinner("Waiting for jail to die", ui.SuffixElapsed(), nil)
	defer spin.Finish()
retry:
	switch status := c.Status(); status {
	case PodStatusStopped:
		// All's fine
		return nil
	case PodStatusRunning:
		if err := c.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)
	}
}