path
end
- at_exit do
+ def do_at_exit
@in.close if @in.respond_to? :close
@out.close if @out.respond_to? :close
+ exit_status = "OK"
+
+ rescue SignalException => exception
+ if exception.class.to_s.upcase =~ /INT/
+ exit_status = "INTERRUPTED"
+ elsif exception.to_s.upcase =~ /TERM/
+ exit_status = "TERMINATED"
+ elsif exception.to_s.upcase =~ /QUIT/
+ exit_status = "QUIT"
+ end
+
+ rescue Exception => exception
+ exit_status = "DIED"
+
+ $stderr.puts exception
+ $stderr.puts exception.backtrace
+
+ ensure
status = Status.new
FileUtils.remove_entry_secure(status.get_tmpdir)
-
- status.log(@exit_status)
+ status.log(exit_status)
status.delete
end
+
+ at_exit {do_at_exit}
end