summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2017-08-02 02:50:12 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2017-08-02 02:50:26 +0900
commit39dbc8acdbb41a1010bc38474e0a308cd0fc25e9 (patch)
tree89da0e4c90f2ee2c66f3f55268ca7393af584a3c
parenta56489bc7f6b2f0ff8925b69089d7b3fea1ef235 (diff)
Exit 2 instead of panic when failed to open /dev/tty
-rw-r--r--src/tui/light.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/tui/light.go b/src/tui/light.go
index a7d12f31..f9059180 100644
--- a/src/tui/light.go
+++ b/src/tui/light.go
@@ -32,7 +32,8 @@ var offsetRegexp *regexp.Regexp = regexp.MustCompile("\x1b\\[([0-9]+);([0-9]+)R"
func openTtyIn() *os.File {
in, err := os.OpenFile(consoleDevice, syscall.O_RDONLY, 0)
if err != nil {
- panic("Failed to open " + consoleDevice)
+ fmt.Fprintln(os.Stderr, "Failed to open "+consoleDevice)
+ os.Exit(2)
}
return in
}