From 429529bda8db013808f4277e74d78f0d46291453 Mon Sep 17 00:00:00 2001 From: Eugene Kenny Date: Sun, 27 Mar 2016 00:32:46 +0000 Subject: Fix warnings test/channel_test.rb:6: warning: assigned but unused variable - c1 test/channel_test.rb:6: warning: assigned but unused variable - c2 test/channel_test.rb:6: warning: assigned but unused variable - c3 lib/net/ssh/multi/pending_connection.rb:46: warning: `*' interpreted as argument prefix lib/net/ssh/multi/session_actions.rb:124: warning: shadowing outer local variable - ch lib/net/ssh/multi/session_actions.rb:134: warning: shadowing outer local variable - ch lib/net/ssh/multi/session_actions.rb:144: warning: shadowing outer local variable - ch test/session_actions_test.rb:97: warning: shadowing outer local variable - c lib/net/ssh/multi/server.rb:138: warning: instance variable @session not initialized --- lib/net/ssh/multi/pending_connection.rb | 2 +- lib/net/ssh/multi/server.rb | 1 + lib/net/ssh/multi/session_actions.rb | 4 ++-- test/channel_test.rb | 2 +- test/session_actions_test.rb | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/net/ssh/multi/pending_connection.rb b/lib/net/ssh/multi/pending_connection.rb index 268ae3c..5faaf70 100644 --- a/lib/net/ssh/multi/pending_connection.rb +++ b/lib/net/ssh/multi/pending_connection.rb @@ -43,7 +43,7 @@ module Net; module SSH; module Multi def replay_on(session) forward = session.forward - @recordings.each {|args| forward.send *args} + @recordings.each { |args| forward.send(*args) } end end diff --git a/lib/net/ssh/multi/server.rb b/lib/net/ssh/multi/server.rb index 58083e3..0094982 100644 --- a/lib/net/ssh/multi/server.rb +++ b/lib/net/ssh/multi/server.rb @@ -56,6 +56,7 @@ module Net; module SSH; module Multi @gateway = @options.delete(:via) @failed = false + @session = @ready_session = nil end # Returns the value of the server property with the given +key+. Server diff --git a/lib/net/ssh/multi/session_actions.rb b/lib/net/ssh/multi/session_actions.rb index 2d87392..c6b1355 100644 --- a/lib/net/ssh/multi/session_actions.rb +++ b/lib/net/ssh/multi/session_actions.rb @@ -118,8 +118,8 @@ module Net; module SSH; module Multi # end def exec(command, &block) open_channel do |channel| - channel.exec(command) do |ch, success| - raise "could not execute command: #{command.inspect} (#{ch[:host]})" unless success + channel.exec(command) do |c, success| + raise "could not execute command: #{command.inspect} (#{c[:host]})" unless success channel.on_data do |ch, data| if block diff --git a/test/channel_test.rb b/test/channel_test.rb index 2c08573..475c59b 100644 --- a/test/channel_test.rb +++ b/test/channel_test.rb @@ -3,7 +3,7 @@ require 'net/ssh/multi/channel' class ChannelTest < Minitest::Test def test_each_should_iterate_over_each_component_channel - channels = [c1 = mock('channel'), c2 = mock('channel'), c3 = mock('channel')] + channels = [mock('channel'), mock('channel'), mock('channel')] channel = Net::SSH::Multi::Channel.new(mock('session'), channels) result = [] channel.each { |c| result << c } diff --git a/test/session_actions_test.rb b/test/session_actions_test.rb index e6de5b1..c9e29d6 100644 --- a/test/session_actions_test.rb +++ b/test/session_actions_test.rb @@ -94,7 +94,7 @@ class SessionActionsTest < Minitest::Test c.expects(:on_extended_data).yields(c, 1, "stderr") c.expects(:on_request) results = {} - @session.exec("something") do |c, stream, data| + @session.exec("something") do |_, stream, data| results[stream] = data end assert_equal({:stdout => "stdout", :stderr => "stderr"}, results) -- cgit v1.2.1