From 9a3700b60aa571ac77f4d41436989441a2fa2773 Mon Sep 17 00:00:00 2001 From: Soulou Date: Mon, 16 Feb 2015 22:53:04 +0100 Subject: [PATCH] Quit without error on Ctrl^D --- main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main.go b/main.go index 592c4b1..55a3d0d 100644 --- a/main.go +++ b/main.go @@ -2,6 +2,7 @@ package main import ( "fmt" + "io" "os" "strconv" "strings" @@ -38,6 +39,10 @@ func main() { for { text, err := term.ReadLine() if err != nil { + if err == io.EOF { + // Quit without error on Ctrl^D + break + } panic(err) }