Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions tests/test_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,21 @@ async def test():

self.loop.run_until_complete(test())

@unittest.skipIf(sys.version_info < (3, 8, 0),
"3.5 to 3.7 does not support path-like objects "
"in the asyncio subprocess API")
def test_process_executable_2(self):
async def test():
proc = await asyncio.create_subprocess_exec(
pathlib.Path(sys.executable),
b'-W', b'ignore', b'-c', b'print("spam")',
stdout=subprocess.PIPE)

out, err = await proc.communicate()
self.assertEqual(out, b'spam\n')

self.loop.run_until_complete(test())

def test_process_pid_1(self):
async def test():
prog = '''\
Expand Down
7 changes: 7 additions & 0 deletions uvloop/handles/process.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,13 @@ cdef class UVProcess(UVHandle):
self.__args = args.copy()
for i in range(an):
arg = args[i]
try:
fspath = type(arg).__fspath__
except AttributeError:
pass
else:
arg = fspath(arg)

if isinstance(arg, str):
self.__args[i] = PyUnicode_EncodeFSDefault(arg)
elif not isinstance(arg, bytes):
Expand Down