Added java11 args

This commit is contained in:
Robinson 2022-01-20 01:09:02 +01:00
parent 9463a09dd6
commit 77fa8b6186
No known key found for this signature in database
GPG Key ID: 8E7DB78588BD6F5C
3 changed files with 34 additions and 3 deletions

View File

@ -54,6 +54,7 @@ class ProcessExecutorShutdownHookTest {
.enableRead()
.defaultLogger()
.asJvmProcess()
.addArg("-add-opens java.base/java.lang=ALL-UNNAMED")
.cloneClasspath()
.setMainClass(TestSetup.getFile(loopStarterClassFile))
.startBlocking()

View File

@ -19,6 +19,9 @@
package dorkbox.executor.shutdown;
import java.io.File;
import java.io.IOException;
import dorkbox.executor.Executor;
import dorkbox.executor.samples.TestSetup;
@ -44,13 +47,39 @@ class WriterLoopStarterAfterExit implements Runnable {
public
void run() {
try {
new Executor("java", TestSetup.INSTANCE.getFile(WriterLoop.class))
.destroyOnExit()
.startBlocking();
// silly workarounds, because executing java files from CLI, require SINGLE-FILE access!
String path = getFile(WriterLoopStarterBeforeExit.class)
.replace(WriterLoopStarterBeforeExit.class.getSimpleName(), "WriterLoop");
System.out.println("Starting output: " + path);
new Executor()
.redirectOutputAsInfo()
.redirectErrorAsInfo()
.asJvmProcess()
.addArg("-add-opens java.base/java.lang=ALL-UNNAMED")
.cloneClasspath()
.setMainClass(path)
.startBlocking();
Thread.sleep(SLEEP_AFTER_START);
} catch (Exception e) {
e.printStackTrace();
}
}
private static String getFile(Class javaClass) throws IOException {
String properName;
if (Executor.Companion.getIS_OS_WINDOWS()) {
properName = javaClass.getName().replace('.', '\\');
} else {
properName = javaClass.getName().replace('.', '/');
}
File file = new File("test", properName + ".java").getAbsoluteFile().getCanonicalFile();
return file.getPath();
}
}

View File

@ -44,6 +44,7 @@ class WriterLoopStarterBeforeExit {
.redirectOutputAsInfo()
.redirectErrorAsInfo()
.asJvmProcess()
.addArg("-add-opens java.base/java.lang=ALL-UNNAMED")
.cloneClasspath()
.setMainClass(path)
.startBlocking();