Skip to content

Commit 2d075f8

Browse files
committed
Fix: cwd arg of fork_exec can be path-like
1 parent 18af870 commit 2d075f8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/PosixSubprocessModuleBuiltins.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ int forkExecDefault(VirtualFrame frame, Object args, Object executable_list, Obj
344344
@Cached CastToListNode castArgs,
345345
@Cached CastToListNode castExecList,
346346
@Cached CastToListNode castFdsToKeep,
347+
@CachedLibrary(limit = "1") PythonObjectLibrary cwdLib,
347348
@Cached CastToJavaStringNode castCwd,
348349
@Cached CastToListNode castEnv,
349350
@CachedLibrary(limit = "3") PythonObjectLibrary lib) {
@@ -352,7 +353,7 @@ int forkExecDefault(VirtualFrame frame, Object args, Object executable_list, Obj
352353
actualCwd = getContext().getEnv().getCurrentWorkingDirectory().getPath();
353354
} else {
354355
try {
355-
actualCwd = castCwd.execute(cwd);
356+
actualCwd = castCwd.execute(cwdLib.asPathWithState(cwd, PArguments.getThreadState(frame)));
356357
} catch (CannotCastException e) {
357358
throw raise(PythonBuiltinClassType.TypeError, ErrorMessages.EXPECTED_S_P_FOUND, "bytes", cwd);
358359
}

0 commit comments

Comments
 (0)