Sha256: 122947c3e18a3fba5d003828739583cd1800dc6e750727659e94fe6526356012

Contents?: true

Size: 453 Bytes

Versions: 18

Compression:

Stored size: 453 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

18 entries across 18 versions & 1 rubygems

Version Path
quality-27.4.0 lib/quality/process.rb
quality-27.3.1 lib/quality/process.rb
quality-27.3.0 lib/quality/process.rb
quality-27.2.0 lib/quality/process.rb
quality-27.1.1 lib/quality/process.rb
quality-27.1.0 lib/quality/process.rb
quality-27.0.0 lib/quality/process.rb
quality-26.0.0 lib/quality/process.rb
quality-25.0.0 lib/quality/process.rb
quality-24.0.0 lib/quality/process.rb
quality-23.0.7 lib/quality/process.rb
quality-23.0.6 lib/quality/process.rb
quality-23.0.5 lib/quality/process.rb
quality-23.0.4 lib/quality/process.rb
quality-23.0.3 lib/quality/process.rb
quality-23.0.2 lib/quality/process.rb
quality-23.0.1 lib/quality/process.rb
quality-23.0.0 lib/quality/process.rb