@@ -78,26 +78,18 @@ protected List<String> preprocessArguments(List<String> args, Map<String, String
78
78
argumentCommandLineParser .processArguments ();
79
79
80
80
if (config .readRubyOptEnv ) {
81
+ /* Calling processArguments() here will also add any unrecognized arguments such as
82
+ * --jvm/--native/--vm.* arguments and polyglot options to `config.getUnknownArguments()`, which will
83
+ * then be processed by AbstractLanguageLauncher and Launcher. If we are going to run Native, Launcher
84
+ * will apply VM options to the current process. If we are going to run on JVM, Launcher will collect
85
+ * them and pass them when execve()'ing to bin/java. Polyglot options are parsed by
86
+ * AbstractLanguageLauncher in the final process. */
81
87
// Process RUBYOPT
82
88
final List <String > rubyoptArgs = getArgsFromEnvVariable ("RUBYOPT" );
83
89
new CommandLineParser (rubyoptArgs , config , false , true ).processArguments ();
84
90
// Process TRUFFLERUBYOPT
85
91
final List <String > trufflerubyoptArgs = getArgsFromEnvVariable ("TRUFFLERUBYOPT" );
86
92
new CommandLineParser (trufflerubyoptArgs , config , false , false ).processArguments ();
87
-
88
- if (isAOT ()) {
89
- /* Append options from ENV variables to args after the last interpreter option, which makes sure
90
- * that maybeExec() processes the --vm.* options. These options are removed and are not passed to
91
- * the new process if exec() is being called as these options need to be passed when starting the
92
- * new VM process. The new process gets all arguments and options including those from ENV
93
- * variables. To avoid processing options from ENV variables twice, --disable-rubyopt is passed.
94
- * Only the native launcher can apply native and jvm options (it is too late for the running JVM to
95
- * apply --vm options), therefore this is not done on JVM. */
96
- final int index = argumentCommandLineParser .getLastInterpreterArgumentIndex ();
97
- args .add (index , "--disable-rubyopt" );
98
- args .addAll (index + 1 , rubyoptArgs );
99
- args .addAll (index + 1 + rubyoptArgs .size (), trufflerubyoptArgs );
100
- }
101
93
}
102
94
103
95
// Process RUBYLIB, must be after arguments and RUBYOPT
0 commit comments