File: main.go

package info (click to toggle)
golang-github-odeke-em-cli-spinner 0.0~git20150423.610063b-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 84 kB
  • ctags: 13
  • sloc: makefile: 6
file content (28 lines) | stat: -rw-r--r-- 347 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package main

import (
	"os"
	"os/signal"
	"time"

	"github.com/odeke-em/cli-spinner"
)

func main() {
	spin := spinner.New(10)

	sigChan := make(chan os.Signal, 1)
	signal.Notify(sigChan, os.Interrupt, os.Kill)
	go func() {
		_ = <-sigChan
		spin.Stop()
		os.Exit(-1)
	}()

	spin.Start()
	throttle := time.Tick(1e9 / 1)

	for {
		<-throttle
	}
}