Class: FTest::Runner::ProcessSet::Process
- Inherits:
-
Object
- Object
- FTest::Runner::ProcessSet::Process
- Defined in:
- lib/ftest/runner.rb
Instance Attribute Summary collapse
-
#fd ⇒ Object
readonly
Returns the value of attribute fd.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#pid ⇒ Object
readonly
Returns the value of attribute pid.
Instance Method Summary collapse
- #finish ⇒ Object
-
#initialize(file) ⇒ Process
constructor
A new instance of Process.
- #print_stacktrace(error) ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(file) ⇒ Process
Returns a new instance of Process.
95 96 97 |
# File 'lib/ftest/runner.rb', line 95 def initialize file @file = file end |
Instance Attribute Details
#fd ⇒ Object (readonly)
Returns the value of attribute fd.
91 92 93 |
# File 'lib/ftest/runner.rb', line 91 def fd @fd end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
92 93 94 |
# File 'lib/ftest/runner.rb', line 92 def file @file end |
#pid ⇒ Object (readonly)
Returns the value of attribute pid.
93 94 95 |
# File 'lib/ftest/runner.rb', line 93 def pid @pid end |
Instance Method Details
#finish ⇒ Object
129 130 131 132 133 134 135 |
# File 'lib/ftest/runner.rb', line 129 def finish fd.read 1 _, status = ::Process.wait2 pid status = status.exitstatus Config.logger.debug "finished script #{@file}; status=#{status.inspect}" status == 0 end |
#print_stacktrace(error) ⇒ Object
117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/ftest/runner.rb', line 117 def print_stacktrace error locations = error.backtrace final_location = locations.shift locations = FTest::BacktraceFilter.(locations) lines = locations.map do |loc| "\tfrom #{loc}" end lines.unshift "#{final_location}: #{error.}" lines.reverse! if Config.reverse_backtraces Config.logger.error "Exception:\n#{lines * "\n"}" end |
#start ⇒ Object
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/ftest/runner.rb', line 99 def start @fd, wr = IO.pipe @pid = fork do @fd.close begin load file rescue => error print_stacktrace error exit 1 ensure wr.write "\x00" end end freeze end |