Sha256: eff0e390982a750fc5f600a4906192495a44521d93afe60098a5169aacd00f61

Contents?: true

Size: 707 Bytes

Versions: 5

Compression:

Stored size: 707 Bytes

Contents

require 'background_process'

module Aruba
  class Process
    def initialize(cmd, timeout)
      @cmd = cmd
      @timeout = timeout
    end

    def run!(&block)
      @process = BackgroundProcess.run(@cmd)
      yield self if block_given?
    end

    def stdin
      @process.stdin
    end

    def output
      stdout + stderr
    end

    def stdout
      if @process
        @stdout ||= @process.stdout.read
      else
        ''
      end
    end

    def stderr
      if @process
        @stderr ||= @process.stderr.read
      else
        ''
      end
    end

    def stop
      if @process
        status = @process.wait(@timeout)
        status && status.exitstatus
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
vim-jar-0.1.2.0001 bundler/ruby/1.8/gems/aruba-0.2.6/lib/aruba/process.rb
vim-jar-0.1.2 bundler/ruby/1.8/gems/aruba-0.2.6/lib/aruba/process.rb
vim-jar-0.1.1 bundler/ruby/1.8/gems/aruba-0.2.6/lib/aruba/process.rb
vim-jar-0.1.0 bundler/ruby/1.8/gems/aruba-0.2.6/lib/aruba/process.rb
aruba-0.2.6 lib/aruba/process.rb