From 7e389bf31b96e8975c1ae52bdf81a410d89f5b4a Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Tue, 15 Dec 2009 12:25:23 +0100 Subject: [PATCH] Catch EOFerror in read_input, making it mean the default answer was selected --- pws | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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" -- 2.39.5