Class Net::SSH::Service::Process::POpen3Manager
In: lib/net/ssh/service/process/popen3.rb
Parent: Object

A delegate class for managing popen3 requests for remote processes.

Methods

new   popen3  

Classes and Modules

Class Net::SSH::Service::Process::POpen3Manager::SSHOutputPipe
Class Net::SSH::Service::Process::POpen3Manager::SSHStderrPipe
Class Net::SSH::Service::Process::POpen3Manager::SSHStdinPipe
Class Net::SSH::Service::Process::POpen3Manager::SSHStdoutPipe

Public Class methods

Create a new POpen3Manager instance on the given connection.

[Source]

    # File lib/net/ssh/service/process/popen3.rb, line 28
28:           def initialize( connection, log )
29:             @connection = connection
30:             @log = log
31:           end

Public Instance methods

Invokes the given command synchronously on the current connection. (This means that parallel commands and operations cannot be executed when this method is used.) This will return nil if the method could not be executed. If the command is successfully invoked, and a block is given, the block is then invoked with the input, output, and error streams of the command as parameters, and the channel is closed as soon as the block terminates. If a block is not given, the input, output, and error channels are returned and the process might not terminate until the session itself terminates.

[Source]

    # File lib/net/ssh/service/process/popen3.rb, line 43
43:           def popen3( command )
44:             @connection.open_channel( "session" ) do |chan|
45: 
46:               chan.on_success do |ch|
47:                 input  = SSHStdinPipe.new( ch )
48:                 output = SSHStdoutPipe.new( ch )
49:                 error  = SSHStderrPipe.new( ch )
50: 
51:                 if block_given?
52:                   yield input, output, error
53:                   chan.close
54:                 else
55:                   return [ input, output, error ]
56:                 end
57:               end
58: 
59:               chan.on_failure do |ch|
60:                 chan.close
61:               end
62: 
63:               chan.exec command, true
64:             end
65: 
66:             @connection.loop
67:             return nil
68:           end

[Validate]