Sha256: 3fc2c35dd64f251c3d52c463016a96bc4b263baafecb403232e2a65e920feb8f

Contents?: true

Size: 613 Bytes

Versions: 23

Compression:

Stored size: 613 Bytes

Contents

# encoding: utf-8
module LocalPac
  class Runner
    private

    attr_reader :command, :stdout

    public

    def initialize(command)
      @command = command
    end

    def run
      stdout, stderr, status = Open3.capture3(command)
      fail RuntimeError, "Error executing command #{command}: #{stderr}, #{stdout}" unless status.success?

      @stdout = stdout.split("\n")
    rescue Errno::ENOENT => e
      fail RuntimeError, "Error executing command #{command}: #{stderr}, #{e.message}"
    end

    def result
      $stderr.puts command if LocalPac.debug_mode
      run
      stdout
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
local_pac-0.6.3 lib/local_pac/runner.rb
local_pac-0.6.2 lib/local_pac/runner.rb
local_pac-0.6.1 lib/local_pac/runner.rb
local_pac-0.5.0 lib/local_pac/runner.rb
local_pac-0.4.0 lib/local_pac/runner.rb
local_pac-0.3.0 lib/local_pac/runner.rb
local_pac-0.2.3 lib/local_pac/runner.rb
local_pac-0.2.2 lib/local_pac/runner.rb
local_pac-0.2.1 lib/local_pac/runner.rb
local_pac-0.2.0 lib/local_pac/runner.rb
local_pac-0.1.13 lib/local_pac/runner.rb
local_pac-0.1.11 lib/local_pac/runner.rb
local_pac-0.1.10 lib/local_pac/runner.rb
local_pac-0.1.9 lib/local_pac/runner.rb
local_pac-0.1.8 lib/local_pac/runner.rb
local_pac-0.1.7 lib/local_pac/runner.rb
local_pac-0.1.6 lib/local_pac/runner.rb
local_pac-0.1.5 lib/local_pac/runner.rb
local_pac-0.1.4 lib/local_pac/runner.rb
local_pac-0.1.3 lib/local_pac/runner.rb