Don't set java.awt.headless if it was set externally

This commit is contained in:
Dmitry Jemerov
2017-05-31 16:00:05 +02:00
parent 5a22917f82
commit 286f82a5c5
@@ -158,7 +158,9 @@ abstract class CLITool<A : CommonToolArguments> {
fun doMain(compiler: CLITool<*>, args: Array<String>) {
// We depend on swing (indirectly through PSI or something), so we want to declare headless mode,
// to avoid accidentally starting the UI thread
System.setProperty("java.awt.headless", "true")
if (System.getProperty("java.awt.headless") == null) {
System.setProperty("java.awt.headless", "true")
}
val exitCode = doMainNoExit(compiler, args)
if (exitCode != ExitCode.OK) {
System.exit(exitCode.code)