def run
if @retried.nil?
@retried = false
else
@retried = true
end
@timestamp = Time.now
@output = []
pid = nil
IO.popen(@script +" 2>&1") do |pipe|
pid = pipe.pid
@output << pipe.gets.to_s.chomp while !pipe.eof?
end
status = $?
raise RuntimeError, "Somehow the command #{@script} didn't execute." unless status.is_a?(::Process::Status)
raise RuntimeError, "Process IDs didn't match when checking #{@script}." if pid != status.pid
@exitstatus = SystemExit.new(status.exitstatus)
@exitstatus.set_backtrace @output
@state_db.record(name, @exitstatus.to_i, @output.join("\n"))
return @exitstatus
end