82
82
import java .util .Set ;
83
83
import java .util .concurrent .TimeUnit ;
84
84
85
- import org .graalvm .nativeimage .ImageInfo ;
86
-
87
85
import com .oracle .graal .python .PythonLanguage ;
88
86
import com .oracle .graal .python .builtins .Builtin ;
89
87
import com .oracle .graal .python .builtins .CoreFunctions ;
@@ -280,18 +278,6 @@ public void postInitialize(PythonCore core) {
280
278
Map <String , String > getenv = System .getenv ();
281
279
PDict environ = core .factory ().createDict ();
282
280
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
-
295
281
String value ;
296
282
if ("__PYVENV_LAUNCHER__" .equals (entry .getKey ())) {
297
283
// 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
364
350
PDict environ = (PDict ) thisModule .getAttribute ("environ" );
365
351
ProcessBuilder builder = new ProcessBuilder (cmd );
366
352
Map <String , String > environment = builder .environment ();
367
- environment .clear ();
368
353
environ .entries ().forEach (entry -> {
369
354
environment .put (new String (toBytes .execute (null , entry .key )), new String (toBytes .execute (null , entry .value )));
370
355
});
@@ -1496,12 +1481,11 @@ PTuple waitpidFallback(VirtualFrame frame, Object pid, Object options,
1496
1481
}
1497
1482
}
1498
1483
1499
- @ Builtin (name = "system" , minNumOfPositionalArgs = 1 , declaresExplicitSelf = true )
1484
+ @ Builtin (name = "system" , minNumOfPositionalArgs = 1 )
1500
1485
@ GenerateNodeFactory
1501
1486
@ TypeSystemReference (PythonArithmeticTypes .class )
1502
1487
abstract static class SystemNode extends PythonBuiltinNode {
1503
1488
private static final TruffleLogger LOGGER = PythonLanguage .getLogger (SystemNode .class );
1504
- @ Child private BytesNodes .ToBytesNode toBytes = BytesNodes .ToBytesNode .create ();
1505
1489
1506
1490
static final String [] shell ;
1507
1491
static {
@@ -1552,7 +1536,7 @@ public void finish() {
1552
1536
1553
1537
@ TruffleBoundary
1554
1538
@ Specialization
1555
- int system (PythonModule thisModule , String cmd ) {
1539
+ int system (String cmd ) {
1556
1540
PythonContext context = getContext ();
1557
1541
if (!context .isExecutableAccessAllowed ()) {
1558
1542
return -1 ;
@@ -1562,13 +1546,6 @@ int system(PythonModule thisModule, String cmd) {
1562
1546
Env env = context .getEnv ();
1563
1547
try {
1564
1548
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
- });
1572
1549
pb .directory (new File (env .getCurrentWorkingDirectory ().getPath ()));
1573
1550
PipePump stdout = null , stderr = null ;
1574
1551
boolean stdsArePipes = !terminalIsInteractive (context );
0 commit comments