1
0
Fork 0
mirror of https://github.com/capistrano/capistrano synced 2023-03-27 23:21:18 -04:00

feat: fallback ask to default when in non interactive run

This commit is contained in:
Ben Rexin 2018-03-28 16:39:28 +02:00 committed by Matt Brictson
parent 92bfd11568
commit 3cff8cbdfa
No known key found for this signature in database
GPG key ID: 2F279EAD1F2ACFAF
3 changed files with 14 additions and 0 deletions

View file

@ -19,6 +19,7 @@ gem "capistrano", github: "capistrano/capistrano", require: false
[master]: https://github.com/capistrano/capistrano/compare/v3.10.2...HEAD
* Your contribution here!
* [#1972](https://github.com/capistrano/capistrano/pull/1972): fallback ask to default when used in non interactive session
## [`3.10.2`] (2018-04-15)

View file

@ -36,6 +36,8 @@ module Capistrano
end
def gets
return unless $stdin.tty?
if echo?
$stdin.gets
else

View file

@ -57,6 +57,17 @@ module Capistrano
expect(question.call).to eq(branch)
end
end
context "tty unavailable" do
before do
$stdin.expects(:gets).never
$stdin.expects(:tty?).returns(false)
end
it "returns the default as the value" do
expect(question.call).to eq(default)
end
end
end
end
end