Set thread context classloader in preloader

#KT-33529 fixed
This commit is contained in:
Ilya Chernikov
2019-08-26 17:59:52 +02:00
parent 7b2f39530a
commit d3f32c0d8a
3 changed files with 14 additions and 0 deletions

View File

@@ -63,6 +63,8 @@ public class Preloader {
Class<?> mainClass = preloaded.loadClass(options.mainClass);
Method mainMethod = mainClass.getMethod("main", String[].class);
Thread.currentThread().setContextClassLoader(preloaded);
Runtime.getRuntime().addShutdownHook(
new Thread(new Runnable() {
@Override

View File

@@ -0,0 +1,3 @@
package test
println("Hello!")

View File

@@ -79,6 +79,15 @@ class LauncherScriptTest : TestCaseWithTmpdir() {
)
}
fun testKotlincJvmSimpleScript() {
runProcess(
"kotlinc-jvm",
"-script",
"$testDataDirectory/helloWorld.kts",
expectedStdout = "Hello!\n"
)
}
fun testKotlincJsSimple() {
runProcess(
"kotlinc-js",