Sha256: ae62d7529efe1b541dd463fabd2737a45d48cce80f027095d3ba339ee3b747ef

Contents?: true

Size: 406 Bytes

Versions: 9

Compression:

Stored size: 406 Bytes

Contents

require 'English'

module Quality
  # Wrapper around IO.popen that allows exit status to be mocked in tests.
  class Process
    def initialize(full_cmd,
                   dependencies = {})
      @full_cmd = full_cmd
      @popener = dependencies[:popener] || IO
    end

    def run
      @popener.popen(@full_cmd) do |file|
        yield file
      end
      $CHILD_STATUS.exitstatus
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
quality-17.1.1 lib/quality/process.rb
quality-17.1.0 lib/quality/process.rb
quality-17.0.0 lib/quality/process.rb
quality-16.0.1 lib/quality/process.rb
quality-16.0.0 lib/quality/process.rb
quality-15.0.1 lib/quality/process.rb
quality-15.0.0 lib/quality/process.rb
quality-14.1.0 lib/quality/process.rb
quality-14.0.0 lib/quality/process.rb