From: Peter Palfrader Date: Tue, 15 Dec 2009 11:25:23 +0000 (+0100) Subject: Catch EOFerror in read_input, making it mean the default answer was selected X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e389bf31b96e8975c1ae52bdf81a410d89f5b4a;p=pwstore Catch EOFerror in read_input, making it mean the default answer was selected --- diff --git a/pws b/pws index 439eb7c..4bf3682 100755 --- a/pws +++ b/pws @@ -194,7 +194,11 @@ def read_input(query, default_yes=true) while true print "#{query} #{append} " - i = STDIN.readline.chomp.downcase + begin + i = STDIN.readline.chomp.downcase + rescue EOFError + return default_yes + end if i=="" return default_yes elsif i=="y"