Sha256: 666109aabd0a8856e74c8242caa1b86c54e52cb3c20286c9acf30b3a2defc055

Contents?: true

Size: 454 Bytes

Versions: 13

Compression:

Stored size: 454 Bytes

Contents

# frozen_string_literal: true

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 if $CHILD_STATUS
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
quality-33.0.0 lib/quality/process.rb
quality-32.1.1 lib/quality/process.rb
quality-32.1.0 lib/quality/process.rb
quality-32.0.0 lib/quality/process.rb
quality-31.3.0 lib/quality/process.rb
quality-31.2.1 lib/quality/process.rb
quality-31.2.0 lib/quality/process.rb
quality-31.1.0 lib/quality/process.rb
quality-31.0.0 lib/quality/process.rb
quality-30.0.1 lib/quality/process.rb
quality-30.0.0 lib/quality/process.rb
quality-29.0.0 lib/quality/process.rb
quality-28.0.0 lib/quality/process.rb