Sha256: 613bea0d867d768c1f8630550ea8c264635cf943e461eb9b8e1838df4af34c77

Contents?: true

Size: 475 Bytes

Versions: 2

Compression:

Stored size: 475 Bytes

Contents

require 'open3'

module Environmate
  module Command

    def command(cmd)
      stdout, stderr, status = Open3.capture3(cmd)
      unless status.success?
        message = []
        message << "Command '#{cmd}' failed"
        message << 'Status:' + status.exitstatus.to_s
        message << "Stdout:\n" + stdout.strip
        message << "Stderr:\n" + stderr.strip
        raise Environmate::DeployError, message.join("\n")
      end
      return stdout
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
environmate-0.1.1 lib/environmate/command.rb
environmate-0.1.0 lib/environmate/command.rb