Sha256: 27c98eaae5232a0cb7e46d1bd7940b188890c75e75187471ae59ce4b189eaa46

Contents?: true

Size: 512 Bytes

Versions: 11

Compression:

Stored size: 512 Bytes

Contents

require 'open3'

module Soaring
  class Executor
    def self.execute(command)
      captured_stdout = ''
      captured_stderr = ''
      exit_status = Open3.popen3(ENV, command) {|stdin, stdout, stderr, wait_thr|
        pid = wait_thr.pid # pid of the started process.
        stdin.close
        captured_stdout = stdout.read
        captured_stderr = stderr.read
        wait_thr.value # Process::Status object returned.
      }
      ["#{captured_stdout}#{captured_stderr}", exit_status]
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
soaring-1.0.0 lib/soaring/tools.rb
soaring-0.1.20 lib/soaring/tools.rb
soaring-0.1.19 lib/soaring/tools.rb
soaring-0.1.18 lib/soaring/tools.rb
soaring-0.1.17 lib/soaring/tools.rb
soaring-0.1.16 lib/soaring/tools.rb
soaring-0.1.15 lib/soaring/tools.rb
soaring-0.1.14 lib/soaring/tools.rb
soaring-0.1.13 lib/soaring/tools.rb
soaring-0.1.12 lib/soaring/tools.rb
soaring-0.1.11 lib/soaring/tools.rb