8282import java .util .Set ;
8383import java .util .concurrent .TimeUnit ;
8484
85- import org .graalvm .nativeimage .ImageInfo ;
86-
8785import com .oracle .graal .python .PythonLanguage ;
8886import com .oracle .graal .python .builtins .Builtin ;
8987import com .oracle .graal .python .builtins .CoreFunctions ;
@@ -280,18 +278,6 @@ public void postInitialize(PythonCore core) {
280278 Map <String , String > getenv = System .getenv ();
281279 PDict environ = core .factory ().createDict ();
282280 for (Entry <String , String > entry : getenv .entrySet ()) {
283- if (!ImageInfo .inImageCode ()) {
284- // both _JAVA_OPTIONS and JAVA_TOOL_OPTIONS are adeed during JVM
285- // startup automatically. We do not want to repeat these, they
286- // are already in our ExecutableList if we're running on the
287- // JVM. OTOH, some script may set these explicitly later on. So
288- // whatever they are right now, we'll empty them, so that any
289- // subprocess launched later will not inherit them.
290- if ("_JAVA_OPTIONS" .equals (entry .getKey ()) || "JAVA_TOOL_OPTIONS" .equals (entry .getKey ())) {
291- continue ;
292- }
293- }
294-
295281 String value ;
296282 if ("__PYVENV_LAUNCHER__" .equals (entry .getKey ())) {
297283 // On Mac, the CPython launcher uses this env variable to specify the real Python
@@ -364,7 +350,6 @@ Object doExecuteInternal(PythonModule thisModule, String path, PSequence args) t
364350 PDict environ = (PDict ) thisModule .getAttribute ("environ" );
365351 ProcessBuilder builder = new ProcessBuilder (cmd );
366352 Map <String , String > environment = builder .environment ();
367- environment .clear ();
368353 environ .entries ().forEach (entry -> {
369354 environment .put (new String (toBytes .execute (null , entry .key )), new String (toBytes .execute (null , entry .value )));
370355 });
@@ -1496,12 +1481,11 @@ PTuple waitpidFallback(VirtualFrame frame, Object pid, Object options,
14961481 }
14971482 }
14981483
1499- @ Builtin (name = "system" , minNumOfPositionalArgs = 1 , declaresExplicitSelf = true )
1484+ @ Builtin (name = "system" , minNumOfPositionalArgs = 1 )
15001485 @ GenerateNodeFactory
15011486 @ TypeSystemReference (PythonArithmeticTypes .class )
15021487 abstract static class SystemNode extends PythonBuiltinNode {
15031488 private static final TruffleLogger LOGGER = PythonLanguage .getLogger (SystemNode .class );
1504- @ Child private BytesNodes .ToBytesNode toBytes = BytesNodes .ToBytesNode .create ();
15051489
15061490 static final String [] shell ;
15071491 static {
@@ -1552,7 +1536,7 @@ public void finish() {
15521536
15531537 @ TruffleBoundary
15541538 @ Specialization
1555- int system (PythonModule thisModule , String cmd ) {
1539+ int system (String cmd ) {
15561540 PythonContext context = getContext ();
15571541 if (!context .isExecutableAccessAllowed ()) {
15581542 return -1 ;
@@ -1562,13 +1546,6 @@ int system(PythonModule thisModule, String cmd) {
15621546 Env env = context .getEnv ();
15631547 try {
15641548 ProcessBuilder pb = new ProcessBuilder (command );
1565- PDict environ = (PDict ) thisModule .getAttribute ("environ" );
1566- ProcessBuilder builder = new ProcessBuilder (cmd );
1567- Map <String , String > environment = pb .environment ();
1568- environment .clear ();
1569- environ .entries ().forEach (entry -> {
1570- environment .put (new String (toBytes .execute (null , entry .key )), new String (toBytes .execute (null , entry .value )));
1571- });
15721549 pb .directory (new File (env .getCurrentWorkingDirectory ().getPath ()));
15731550 PipePump stdout = null , stderr = null ;
15741551 boolean stdsArePipes = !terminalIsInteractive (context );
0 commit comments