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