diff options
author | Christoph Hamsen <37963496+xopham@users.noreply.github.com> | 2022-10-13 16:11:15 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-13 16:11:15 (GMT) |
commit | c9ed0327a9c741a1808926b409df29467baf303a (patch) | |
tree | 335ba2d41d380c2b3ccbc341db55e1f8622b6178 /Lib/test | |
parent | d4b91663857e85eab1f309cacec4d27b5f6657ec (diff) | |
download | cpython-c9ed0327a9c741a1808926b409df29467baf303a.zip cpython-c9ed0327a9c741a1808926b409df29467baf303a.tar.gz cpython-c9ed0327a9c741a1808926b409df29467baf303a.tar.bz2 |
bpo-46364: Use sockets for stdin of asyncio only on AIX (#30596)
Signed-off-by: Christoph Hamsen <hamsen.christoph@posteo.de>
Co-authored-by: July Tikhonov <july.tikh@gmail.com>
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_asyncio/test_subprocess.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_subprocess.py b/Lib/test/test_asyncio/test_subprocess.py index 915ad55..64df1b1 100644 --- a/Lib/test/test_asyncio/test_subprocess.py +++ b/Lib/test/test_asyncio/test_subprocess.py @@ -427,6 +427,26 @@ class SubprocessMixin: self.assertEqual(output, None) self.assertEqual(exitcode, 0) + @unittest.skipIf(sys.platform != 'linux', "Don't have /dev/stdin") + def test_devstdin_input(self): + + async def devstdin_input(message): + code = 'file = open("/dev/stdin"); data = file.read(); print(len(data))' + proc = await asyncio.create_subprocess_exec( + sys.executable, '-c', code, + stdin=asyncio.subprocess.PIPE, + stdout=asyncio.subprocess.PIPE, + stderr=asyncio.subprocess.PIPE, + close_fds=False, + ) + stdout, stderr = await proc.communicate(message) + exitcode = await proc.wait() + return (stdout, exitcode) + + output, exitcode = self.loop.run_until_complete(devstdin_input(b'abc')) + self.assertEqual(output.rstrip(), b'3') + self.assertEqual(exitcode, 0) + def test_cancel_process_wait(self): # Issue #23140: cancel Process.wait() |