Refactor Remote#execute
This commit is contained in:
parent
52dcfcedd3
commit
ff0287b545
@ -25,7 +25,7 @@ module Producer
|
|||||||
end
|
end
|
||||||
|
|
||||||
def execute(command, output = '', error_output = '')
|
def execute(command, output = '', error_output = '')
|
||||||
channel = session.open_channel do |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
|
||||||
@ -40,8 +40,7 @@ module Producer
|
|||||||
fail RemoteCommandExecutionError, command if exit_status != 0
|
fail RemoteCommandExecutionError, command if exit_status != 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end.wait
|
||||||
channel.wait
|
|
||||||
output
|
output
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user