Sha256: 39fc438b7ea45eac0c6186148a5806cdd54ba00a1d3e551f452e0779c74408f2

Contents?: true

Size: 524 Bytes

Versions: 1

Compression:

Stored size: 524 Bytes

Contents

require 'childprocess'

module Scripted
  module Commands
    class Shell

      attr_reader :command

      def initialize(command)
        @command = command
      end

      def execute!(log = STDOUT)
        process = ChildProcess.build(command)

        process.io.stdout = log
        process.io.stderr = log
        process.start

        process.wait
        if process.exit_code != 0
          fail CommandFailed, "`#{command}` failed with exit status #{process.exit_code}"
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scripted-0.0.1 lib/scripted/commands/shell.rb