Fixed an issue preventing to run Ruby unit tests from klayout batch mode

This commit is contained in:
Matthias Koefferlein 2023-08-30 21:49:15 +02:00
parent 512183d55c
commit fdf3a67a9e
1 changed files with 8 additions and 4 deletions

View File

@ -115,13 +115,15 @@ rba_get_backtrace_from_array (VALUE backtrace, std::vector<tl::BacktraceElement>
void void
block_exceptions (bool f) block_exceptions (bool f)
{ {
RubyInterpreter::instance ()->block_exceptions (f); if (RubyInterpreter::instance ()) {
RubyInterpreter::instance ()->block_exceptions (f);
}
} }
bool bool
exceptions_blocked () exceptions_blocked ()
{ {
return RubyInterpreter::instance ()->exceptions_blocked (); return RubyInterpreter::instance () ? RubyInterpreter::instance ()->exceptions_blocked () : false;
} }
void void
@ -161,8 +163,10 @@ rba_check_error ()
std::vector <tl::BacktraceElement> bt; std::vector <tl::BacktraceElement> bt;
rba_get_backtrace_from_array (rb_funcall (lasterr, rb_intern ("backtrace"), 0), bt, 0); rba_get_backtrace_from_array (rb_funcall (lasterr, rb_intern ("backtrace"), 0), bt, 0);
const std::string &ds = RubyInterpreter::instance ()->debugger_scope (); if (RubyInterpreter::instance ()) {
bt.erase (bt.begin (), bt.begin () + RubyStackTraceProvider::scope_index (bt, ds)); const std::string &ds = RubyInterpreter::instance ()->debugger_scope ();
bt.erase (bt.begin (), bt.begin () + RubyStackTraceProvider::scope_index (bt, ds));
}
// parse the backtrace to get the line number // parse the backtrace to get the line number
tl::BacktraceElement info; tl::BacktraceElement info;