Class: Tester::TestProcess
- Inherits:
-
Struct
- Object
- Struct
- Tester::TestProcess
- Defined in:
- lib/tester/test_process.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#pid ⇒ Object
Returns the value of attribute pid.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(command) ⇒ TestProcess
constructor
A new instance of TestProcess.
- #start ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(command) ⇒ TestProcess
Returns a new instance of TestProcess.
5 6 7 |
# File 'lib/tester/test_process.rb', line 5 def initialize(command) @command = command end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
3 4 5 |
# File 'lib/tester/test_process.rb', line 3 def command @command end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
3 4 5 |
# File 'lib/tester/test_process.rb', line 3 def output @output end |
#pid ⇒ Object
Returns the value of attribute pid
2 3 4 |
# File 'lib/tester/test_process.rb', line 2 def pid @pid end |
#status ⇒ Object
Returns the value of attribute status
2 3 4 |
# File 'lib/tester/test_process.rb', line 2 def status @status end |
Instance Method Details
#start ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/tester/test_process.rb', line 9 def start IO.popen("#{command} 2>&1") do |io| @pid = pid @output = io.read end @status = $?.exitstatus.to_i rescue Exception => e end |
#to_hash ⇒ Object
18 19 20 |
# File 'lib/tester/test_process.rb', line 18 def to_hash {:status => status, :output => output} end |