Improve messages on exit

This commit is contained in:
Ivan Danyliuk 2017-12-16 20:51:45 +01:00
parent 28ed76f428
commit 4b137bfdce
No known key found for this signature in database
GPG Key ID: 97ED33CE024E1DBF
2 changed files with 5 additions and 2 deletions

View File

@ -3,6 +3,7 @@ package main
import (
"flag"
"fmt"
"os"
"time"
"github.com/gizak/termui"
@ -56,7 +57,10 @@ func main() {
ui.AddTimer(*interval, func(e termui.Event) {
cpu, err := adbCPU(pid)
if err != nil {
return
// usually that means app closed or phone disconnected
stopUI()
fmt.Println("Disconnected.")
os.Exit(0)
}
// update data

1
top.go
View File

@ -34,7 +34,6 @@ func NewTopOutput(data string) (*TopOutput, error) {
cpu, err := strconv.ParseFloat(line, 64)
if err != nil {
fmt.Println("[ERROR] Parse CPU value:", err)
return nil, ErrParse
}