Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Don't default to closing the input stream when sudo is being used. #254

Merged
merged 1 commit into from

4 participants

@dylanahsmith

Fixes #253

Makes the same check as in Capistrano::Configuration::Actions::Invocation#run_tree to see if sudo is being used, so the input stream will not be closed by default if the sudo_behaviour_callback is being used.

@travisbot

This pull request passes (merged 51296cb into 3632188).

@carsomyr carsomyr was assigned
@carsomyr carsomyr merged commit 51296cb into capistrano:master
@mattdbridges

Can you release a bugfix patch version of this for those of us who are having to revert back to 2.12.0? Much appreciated!

@carsomyr

@mattdbridges Yes, I am working on it. There's another outstanding issue related to deprecation that will probably be bundled with the bugfix version.

@mattdbridges

@carsomyr Ah, thanks for the quick follow up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
4 lib/capistrano/configuration/actions/invocation.rb
@@ -147,7 +147,9 @@ def invoke_command(cmd, options={}, &block)
# variable, they will apply for all invocations of #run, #invoke_command,
# and #parallel.
def run(cmd, options={}, &block)
- options = options.merge(:eof => !block_given?) if options[:eof].nil?
+ if options[:eof].nil? && !cmd.include?(sudo)
+ options = options.merge(:eof => !block_given?)
+ end
block ||= self.class.default_io_proc
tree = Command::Tree.new(self) { |t| t.else(cmd, &block) }
run_tree(tree, options)
View
5 test/configuration/actions/invocation_test.rb
@@ -115,6 +115,11 @@ def test_sudo_should_default_to_sudo
@config.sudo "ls"
end
+ def test_sudo_should_keep_input_stream_open
+ @config.expects(:execute_on_servers).with(:foo => "bar")
+ @config.sudo "ls", :foo => "bar"
+ end
+
def test_sudo_should_use_sudo_variable_definition
@config.expects(:run).with("/opt/local/bin/sudo -p 'sudo password: ' ls", {})
@config.options[:sudo] = "/opt/local/bin/sudo"
Something went wrong with that request. Please try again.