class Dockerploy::ShellClient
Attributes
output[RW]
Public Class Methods
new(options = {})
click to toggle source
# File lib/dockerploy/shell_client.rb, line 5 def initialize(options = {}) @options = options end
Public Instance Methods
command(command)
click to toggle source
# 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 && @options[:abort_on_failure] Dockerploy.logger.error sprintf('Failed to run: %s', command) abort end end