Class: Quality::ProcessRunner
- Inherits:
-
Object
- Object
- Quality::ProcessRunner
- Defined in:
- lib/quality/process_runner.rb
Overview
Wrapper around IO.popen that allows exit status to be mocked in tests.
Instance Method Summary collapse
-
#initialize(full_cmd, dependencies = {}) ⇒ ProcessRunner
constructor
A new instance of ProcessRunner.
- #run ⇒ Object
Constructor Details
#initialize(full_cmd, dependencies = {}) ⇒ ProcessRunner
Returns a new instance of ProcessRunner.
6 7 8 9 10 |
# File 'lib/quality/process_runner.rb', line 6 def initialize(full_cmd, dependencies = {}) @full_cmd = full_cmd @popener = dependencies[:popener] || IO end |
Instance Method Details
#run ⇒ Object
12 13 14 15 16 17 |
# File 'lib/quality/process_runner.rb', line 12 def run @popener.popen(@full_cmd) do |file| yield file end $CHILD_STATUS.exitstatus end |