def self.running_load(code, filename)
errors = ""
watches = []
begin
LOG.start_capture
Gem.clear_paths
eval(code, root_binding, filename)
self.pending_watches.each do |w|
if previous_state = self.pending_watch_states[w.name]
w.monitor unless previous_state == :unmonitored
else
w.monitor if w.autostart?
end
end
watches = self.pending_watches.dup
self.pending_watches.clear
self.pending_watch_states.clear
rescue Exception => e
errors << LOG.finish_capture
unless e.instance_of?(SystemExit)
errors << e.message << "\n"
errors << e.backtrace.join("\n")
end
end
names = watches.map { |x| x.name }
[names, errors]
end