# HG changeset patch # User Edouard Tisserant # Date 1687098648 -7200 # Node ID f7bc4e5832be7353396b57b416b80b1071712c3b # Parent 46f3ca3f0157d6f22f792d6a5c93d1940812f86f Runtime: spawn_subprocess: handle non-bytes args diff -r 46f3ca3f0157 -r f7bc4e5832be runtime/spawn_subprocess.py --- 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)