cmd/viewcore: exit normally with 'bye' and 'exit' commands
exitf is for only abnormal exit cases.
Change-Id: Ica2fbd6e6f4a75b75646e197ee05db29b6d0e1f9
Reviewed-on: https://go-review.googlesource.com/129675
Reviewed-by: Heschi Kreinick <heschi@google.com>
diff --git a/cmd/viewcore/main.go b/cmd/viewcore/main.go
index 04e82a1..2495458 100644
--- a/cmd/viewcore/main.go
+++ b/cmd/viewcore/main.go
@@ -9,6 +9,7 @@
import (
"fmt"
+ "io"
"os"
"runtime/debug"
"runtime/pprof"
@@ -299,7 +300,7 @@
Aliases: []string{"quit", "bye"},
Short: "exit from interactive mode",
Run: func(*cobra.Command, []string) {
- exitf("bye!\n\n")
+ os.Exit(0)
},
})
@@ -311,7 +312,7 @@
shell, err := readline.NewEx(&readline.Config{
Prompt: "(viewcore) ",
AutoComplete: rootCompleter,
- EOFPrompt: "bye!\n\n",
+ EOFPrompt: "\n",
})
if err != nil {
panic(err)
@@ -328,7 +329,9 @@
for {
l, err := shell.Readline()
if err != nil {
- fmt.Printf("Error: %v\n", err)
+ if err != io.EOF {
+ fmt.Printf("Error: %v\n", err)
+ }
break
}