Class: Dockerploy::ShellClient
- Inherits:
-
Object
- Object
- Dockerploy::ShellClient
- Defined in:
- lib/dockerploy/shell_client.rb
Instance Attribute Summary collapse
-
#output ⇒ Object
Returns the value of attribute output.
Instance Method Summary collapse
- #command(command) ⇒ Object
-
#initialize(options = {}) ⇒ ShellClient
constructor
A new instance of ShellClient.
Constructor Details
#initialize(options = {}) ⇒ ShellClient
Returns a new instance of ShellClient.
5 6 7 |
# File 'lib/dockerploy/shell_client.rb', line 5 def initialize( = {}) = end |
Instance Attribute Details
#output ⇒ Object
Returns the value of attribute output.
3 4 5 |
# File 'lib/dockerploy/shell_client.rb', line 3 def output @output end |
Instance Method Details
#command(command) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/dockerploy/shell_client.rb', line 9 def command(command) Dockerploy.logger.debug sprintf('Running: %s', command) IO.popen('-') do |p| if p.nil? $stderr.close exec *command.split(' ') end @output = p.read Dockerploy.logger.debug p.read end return false if $?.nil? result = $?.exitstatus == 0 if !result && [:abort_on_failure] Dockerploy.logger.error sprintf('Failed to run: %s', command) abort end end |