Skip to content

Commit 65dd7b4

Browse files
committed
Make TruffleFile resolve relative paths correctly when we change the native working directory
1 parent ae5c59c commit 65dd7b4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime/NFIPosixSupport.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,13 @@ public void chdir(Object path,
645645
if (result != 0) {
646646
throw newPosixException(invokeNode, getErrno(invokeNode));
647647
}
648+
// TODO we don;t need to do this more than once
649+
try {
650+
TruffleFile truffleFile = context.getEnv().getInternalTruffleFile(".").getAbsoluteFile();
651+
context.getEnv().setCurrentWorkingDirectory(truffleFile);
652+
} catch (Exception e) {
653+
LOGGER.log(Level.WARNING, "Unable to change Truffle working directory", e);
654+
}
648655
}
649656

650657
@ExportMessage

0 commit comments

Comments
 (0)