Skip to content

Commit 52f85a3

Browse files
committed
Accept windows-specific flags in subprocess module
1 parent b3a5ac0 commit 52f85a3

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

graalpython/lib-python/3/subprocess.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,8 @@
7272
except ModuleNotFoundError:
7373
_mswindows = False
7474
else:
75-
# Truffle change
76-
# _mswindows = True
77-
_mswindows = False
75+
# GraalPy change: under emulated posix, use the posix APIs even under windows
76+
_mswindows = not (sys.implementation.name == 'graalpy' and __graalpython__.posix_module_backend() == 'java')
7877

7978
# wasm32-emscripten and wasm32-wasi do not support processes
8079
_can_fork_exec = sys.platform not in {"emscripten", "wasi"}
@@ -850,12 +849,14 @@ def __init__(self, args, bufsize=-1, executable=None,
850849
if pass_fds and not close_fds:
851850
warnings.warn("pass_fds overriding close_fds.", RuntimeWarning)
852851
close_fds = True
853-
if startupinfo is not None:
854-
raise ValueError("startupinfo is only supported on Windows "
855-
"platforms")
856-
if creationflags != 0:
857-
raise ValueError("creationflags is only supported on Windows "
858-
"platforms")
852+
# GraalPy change: allow and ignore windows-specific flags on windows on posix backend
853+
if sys.platform != 'win32':
854+
if startupinfo is not None:
855+
raise ValueError("startupinfo is only supported on Windows "
856+
"platforms")
857+
if creationflags != 0:
858+
raise ValueError("creationflags is only supported on Windows "
859+
"platforms")
859860

860861
self.args = args
861862
self.stdin = None

0 commit comments

Comments
 (0)