runtime/spawn_subprocess.py
changeset 3821 f7bc4e5832be
parent 3750 f62625418bff
child 3881 0b3ac94f494c
--- a/runtime/spawn_subprocess.py	Sun Jun 18 16:28:42 2023 +0200
+++ b/runtime/spawn_subprocess.py	Sun Jun 18 16:30:48 2023 +0200
@@ -5,13 +5,14 @@
 
 
 
-import os
+import os, sys
 import signal
 import shlex
 import posix_spawn
 
 PIPE = "42"
 
+fsencoding = sys.getfilesystemencoding()
 
 class Popen(object):
     def __init__(self, args, stdin=None, stdout=None):
@@ -34,6 +35,7 @@
             file_actions.add_dup2(p2cread, 0)
             # close other end
             file_actions.add_close(p2cwrite)
+        args = [s.encode(fsencoding) for s in args if type(s)==str]
         self.pid = posix_spawn.posix_spawnp(args[0], args, file_actions=file_actions)
         if stdout is not None:
             self.stdout = os.fdopen(c2pread)