Skip to content

Commit 1eed7a5

Browse files
committed
strip _JAVA_OPTIONS and JAVA_TOOL_OPTIONS from our ExecutableList instead
1 parent 41da0a5 commit 1eed7a5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

graalpython/com.oracle.graal.python.shell/src/com/oracle/graal/python/shell/GraalPythonMain.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,19 @@ private String[] getExecutableList() {
309309
ArrayList<String> exec_list = new ArrayList<>();
310310
sb.append(System.getProperty("java.home")).append(File.separator).append("bin").append(File.separator).append("java");
311311
exec_list.add(sb.toString());
312+
String javaOptions = System.getenv("_JAVA_OPTIONS");
313+
String javaToolOptions = System.getenv("JAVA_TOOL_OPTIONS");
312314
for (String arg : ManagementFactory.getRuntimeMXBean().getInputArguments()) {
313315
if (arg.matches("-Xrunjdwp:transport=dt_socket,server=y,address=\\d+,suspend=y")) {
314316
arg = arg.replace("suspend=y", "suspend=n");
315317
}
318+
if ((javaOptions != null && javaOptions.contains(arg)) || (javaToolOptions != null && javaToolOptions.contains(arg))) {
319+
// both _JAVA_OPTIONS and JAVA_TOOL_OPTIONS are adeed during
320+
// JVM startup automatically. We do not want to repeat these
321+
// for subprocesses, because they should also pick up those
322+
// variables.
323+
continue;
324+
}
316325
exec_list.add(arg);
317326
}
318327
exec_list.add("-classpath");

0 commit comments

Comments
 (0)