Fix unexpected blocking in Remote::execute:

Wait for inactivity on the specific channel we open for the execution
instead of looping the global session.
This commit is contained in:
Thibault Jouan 2014-03-05 05:23:08 +00:00
parent b92dfcc9b7
commit 400fa1ee3f

View File

@ -25,7 +25,7 @@ module Producer
def execute(command) def execute(command)
output = '' output = ''
session.open_channel do |channel| channel = session.open_channel do |channel|
channel.exec command do |ch, success| channel.exec command do |ch, success|
ch.on_data do |c, data| ch.on_data do |c, data|
output << data output << data
@ -37,7 +37,7 @@ module Producer
end end
end end
end end
session.loop channel.wait
output output
end end