Skip to content

Commit 6407746

Browse files
Return if gets from stdin returns nil
1 parent 37a2e33 commit 6407746

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/thor/shell/basic.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,11 @@ def ask_simply(statement, options = {}, color=nil)
376376
default = options[:default]
377377
message = [statement, ("(#{default.inspect})" if default), nil].uniq.join(" ")
378378
say(message, color)
379-
result = stdin.gets.tap{|text| text.strip! if text}
379+
result = stdin.gets
380+
381+
return unless result
382+
383+
result.strip!
380384

381385
if default && result == ""
382386
default

0 commit comments

Comments
 (0)