Class | Net::SSH::Service::Process::OpenManager |
In: |
lib/net/ssh/service/process/open.rb
|
Parent: | Object |
A delegate class to manage the processing for a single executed process on the remote host. It opens a channel, executes the process on it, and manages the various callbacks.
This service is typically used like this:
Net::SSH.start( 'host', 'user' ) do |session| session.process.open( "bc" ) do |process| ... end end
Create a new OpenManager instance on the given connection. It will attempt to execute the given command. If a block is given, the manager will be yielded to the block, and the constructor will not return until all channels are closed.
Close the process. All streams (stdin, stdout, stderr) will be closed. Any output that the process had already produced will still be sent, but it will be shut down as soon as possible. This will return immediately.
Indicate that no more data will be sent to the process (sends an EOF to the process). The process may continue to send data, but the stdin stream is effectively closed. This will return immediately.
Invoked when the channel is closed. This simply delegates to the on_exit callback, if registered.
Invoked when the channel’s opening has been confirmed by the server. This is where the command to execute will be sent to the server.
Invoked when data arrives over the channel. This simply delegates to the on_stdout callback, if registered.
Invoked when the invocation of the command failed. This will call the on_failure callback, if registered, or will otherwise raise an exception.
Invoked when the invocation of the command has been successful. This registers various callbacks, and then calls the on_success callback (if registered).
Invoked when extended data arrives over the channel. This simply delegates to the on_stderr callback, if registered, if the type is 1; otherwise it does nothing.
Register the given block to be invoked when the process terminates normally. The block should accept two parameters: the process instance (self) and the exit status of the process.
Register the given block to be invoked when the command could not be started. The block should accept two parameters: the process instance (self) and a status string. (The status string is currently always nil, since SSH itself does not indicate why the program failed to start.)
Register the given block to be invoked when data is recieved from the invoked command’s stderr stream. The block should accept two parameters: the process instance (self) and the data string. Note that if the process sends large amounts of data, this method may be invoked multiple times, each time with a portion of the command’s error output.
Register the given block to be invoked when data is recieved from the invoked command’s stdout stream. The block should accept two parameters: the process instance (self) and the data string. Note that if the process sends large amounts of data, this method may be invoked multiple times, each time with a portion of the command’s output.
Register the given block to be invoked when the command has been confirmed to have been successfully started. The block should accept a single parameter, the process instance that was created (self).
Send the given data to the process, appending a newline. As with Kernel::puts, this will not append a newline if the string already has one. See write.