]> err.no Git - pwstore/commitdiff
Catch EOFerror in read_input, making it mean the default answer was selected
authorPeter Palfrader <peter@palfrader.org>
Tue, 15 Dec 2009 11:25:23 +0000 (12:25 +0100)
committerPeter Palfrader <peter@palfrader.org>
Tue, 15 Dec 2009 11:25:23 +0000 (12:25 +0100)
pws

diff --git a/pws b/pws
index 439eb7c6c7212a8331f8b387d3f276e9c6e7fd41..4bf3682247686010a898554c02d385fc6abc9e98 100755 (executable)
--- 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"