Class: Proclib::Commands::SshCommand
- Inherits:
-
Command
- Object
- Command
- Proclib::Commands::SshCommand
- Defined in:
- lib/proclib/command.rb
Constant Summary collapse
- SSHError =
Class.new(Error)
Constants inherited from Command
Command::NotYetRunning, Command::NotYetTerminated
Instance Attribute Summary collapse
-
#ssh_opts ⇒ Object
readonly
Returns the value of attribute ssh_opts.
Instance Method Summary collapse
-
#initialize(ssh:, **args) ⇒ SshCommand
constructor
A new instance of SshCommand.
- #spawn ⇒ Object
- #wait ⇒ Object
Constructor Details
#initialize(ssh:, **args) ⇒ SshCommand
Returns a new instance of SshCommand.
70 71 72 73 |
# File 'lib/proclib/command.rb', line 70 def initialize(ssh:, **args) @ssh_opts = ssh.clone super(**args) end |
Instance Attribute Details
#ssh_opts ⇒ Object (readonly)
Returns the value of attribute ssh_opts.
66 67 68 |
# File 'lib/proclib/command.rb', line 66 def ssh_opts @ssh_opts end |
Instance Method Details
#spawn ⇒ Object
75 76 77 78 79 80 81 82 83 |
# File 'lib/proclib/command.rb', line 75 def spawn write_pipes open_channel do |ch| ch.exec(cmdline) do |_, success| raise SSHError, "Command Failed" unless success end end end |
#wait ⇒ Object
85 86 87 |
# File 'lib/proclib/command.rb', line 85 def wait ssh_session.loop end |