This commit is contained in:
Horis committed 2024-07-08 08:59:33 +08:00
1 parent dd798012bd
commit a904639959
1 file changed
+4 -4
@@ -98,10 +98,9 @@ internal class RhinoCompiledScript(
}
override fun eval(scope: Scriptable, coroutineContext: CoroutineContext?): Any? {
val cx = Context.enter()
if (cx is RhinoContext) {
cx.coroutineContext = coroutineContext
}
val cx = Context.enter() as RhinoContext
val previousCoroutineContext = cx.coroutineContext
cx.coroutineContext = coroutineContext
val result: Any?
try {
val ret = script.exec(cx, scope)
@@ -117,6 +116,7 @@ internal class RhinoCompiledScript(
se.initCause(re)
throw se
} finally {
cx.coroutineContext = previousCoroutineContext
Context.exit()
}
return result