Sha256: 6036039f9bd00753d700380867da5aeb086828be6ad416718e00a0b812080263

Contents?: true

Size: 633 Bytes

Versions: 3

Compression:

Stored size: 633 Bytes

Contents

module Dockerploy
  class ShellClient
    attr_accessor :output

    def initialize(options = {})
      @options = options
    end

    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
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dockerploy-0.0.5 lib/dockerploy/shell_client.rb
dockerploy-0.0.4 lib/dockerploy/shell_client.rb
dockerploy-0.0.3 lib/dockerploy/shell_client.rb