Class: Net::SSH::Shell
Instance Method Summary collapse
-
#exec!(command, klass = Net::SSH::Shell::Process, &callback) ⇒ Object
Like execute! but returns an array: the status and the output.
Instance Method Details
#exec!(command, klass = Net::SSH::Shell::Process, &callback) ⇒ Object
Like execute! but returns an array: the status and the output.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/monkeypatch.rb', line 5 def exec!(command, klass=Net::SSH::Shell::Process, &callback) result = '' process = klass.new(self, command, callback) process.on_output do |p, output| result << output end process.run if processes.empty? processes << process wait! [process.exit_status, result] end |