Sha256: f8ac7601c968dfa706aa02c34d8b6bd9aee2d6b9f7f002d99e51150a252f8c07

Contents?: true

Size: 438 Bytes

Versions: 16

Compression:

Stored size: 438 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
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
quality-38.0.1 lib/quality/process.rb
quality-38.0.0 lib/quality/process.rb
quality-37.1.1 lib/quality/process.rb
quality-37.1.0 lib/quality/process.rb
quality-37.0.1 lib/quality/process.rb
quality-37.0.0 lib/quality/process.rb
quality-36.1.0 lib/quality/process.rb
quality-36.0.0 lib/quality/process.rb
quality-35.2.1 lib/quality/process.rb
quality-35.2.0 lib/quality/process.rb
quality-35.1.1 lib/quality/process.rb
quality-35.0.1 lib/quality/process.rb
quality-35.0.0 lib/quality/process.rb
quality-34.0.2 lib/quality/process.rb
quality-34.0.1 lib/quality/process.rb
quality-34.0.0 lib/quality/process.rb