@@ -167,9 +167,11 @@ protected List<String> preprocessArguments(List<String> givenArgs, Map<String, S
167
167
polyglotGet (launcherName , givenArgs );
168
168
}
169
169
ArrayList <String > unrecognized = new ArrayList <>();
170
- List <String > defaultEnvironmentArgs = getDefaultEnvironmentArgs ();
171
- ArrayList <String > inputArgs = new ArrayList <>(givenArgs );
172
- inputArgs .addAll (defaultEnvironmentArgs );
170
+ List <String > envVmArgs = getDefaultEnvironmentArgs ("GRAAL_PYTHON_VM_ARGS" );
171
+ List <String > envArgs = getDefaultEnvironmentArgs ("GRAAL_PYTHON_ARGS" );
172
+ ArrayList <String > inputArgs = new ArrayList <>(envVmArgs );
173
+ inputArgs .addAll (givenArgs );
174
+ inputArgs .addAll (envArgs );
173
175
givenArguments = new ArrayList <>(inputArgs );
174
176
List <String > arguments = new ArrayList <>(inputArgs );
175
177
List <String > subprocessArgs = new ArrayList <>();
@@ -1133,7 +1135,7 @@ protected void printHelp(OptionCategory maxCategory) {
1133
1135
" in the range [0,4294967295] to get hash values with a predictable seed.\n " +
1134
1136
"PYTHONPYCACHEPREFIX: if this is set, GraalPython will write .pyc files in a mirror\n " +
1135
1137
" directory tree at this path, instead of in __pycache__ directories within the source tree.\n " +
1136
- "GRAAL_PYTHON_ARGS: the value is added as arguments as if passed on the\n " +
1138
+ "GRAAL_PYTHON_ARGS: the value is added as arguments as if passed at the end of the\n " +
1137
1139
" commandline. Arguments are split on whitespace - you can use \" and/or ' as required to\n " +
1138
1140
" group them. Alternatively, if the value starts with a vertical tab character, the entire\n " +
1139
1141
" value is split at vertical tabs and the elements are used as arguments without any further\n " +
@@ -1143,6 +1145,8 @@ protected void printHelp(OptionCategory maxCategory) {
1143
1145
" with the current process id, and any $UUID$ is replaced with random unique string\n " +
1144
1146
" that may contain letters, digits, and '-'. To pass a literal `$$', you must escape the\n " +
1145
1147
" second `$' like so: `$\\ $'\n " +
1148
+ "GRAAL_PYTHON_VM_ARGS: the value is prepended as arguments as if passed at the beginning\n " +
1149
+ " of the commandline. See GRAAL_PYTHON_ARGS for details.\n " +
1146
1150
(wantsExperimental ? "\n Arguments specific to the Graal Python launcher:\n " +
1147
1151
"--show-version : print the Python version number and continue.\n " +
1148
1152
"-CC : run the C compiler used for generating GraalPython C extensions.\n " +
@@ -1462,15 +1466,15 @@ private static enum State {
1462
1466
VTAB_DELIMITED ,
1463
1467
}
1464
1468
1465
- private static List <String > getDefaultEnvironmentArgs () {
1469
+ private static List <String > getDefaultEnvironmentArgs (String envName ) {
1466
1470
String pid ;
1467
1471
if (isAOT ()) {
1468
1472
pid = String .valueOf (ProcessProperties .getProcessID ());
1469
1473
} else {
1470
1474
pid = ManagementFactory .getRuntimeMXBean ().getName ().split ("@" )[0 ];
1471
1475
}
1472
1476
String uuid = UUID .randomUUID ().toString ();
1473
- String envArgsOpt = getEnv ("GRAAL_PYTHON_ARGS" );
1477
+ String envArgsOpt = getEnv (envName );
1474
1478
ArrayList <String > envArgs = new ArrayList <>();
1475
1479
if (envArgsOpt != null ) {
1476
1480
State s = State .NORMAL ;
0 commit comments