blob: 512d37c1527de16e57a098f0d740949bbbd7b28e (
plain)
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
29
30
31
32
33
34
|
package utils
import (
"fmt"
"os"
"github.com/jroimartin/gocui"
"github.com/sirupsen/logrus"
)
var ui *gocui.Gui
func SetUi(g *gocui.Gui) {
ui = g
}
func PrintAndExit(args ...interface{}) {
logrus.Println(args...)
Cleanup()
fmt.Println(args...)
os.Exit(1)
}
// Note: this should only be used when exiting from non-gocui code
func Exit(rc int) {
Cleanup()
os.Exit(rc)
}
func Cleanup() {
if ui != nil {
ui.Close()
}
}
|