commit: 7ea1175091886baa677d11290d4b725a64e68710 Author: Zac Medico <zmedico <AT> gentoo <DOT> org> AuthorDate: Sat Feb 3 19:36:13 2024 +0000 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> CommitDate: Sat Feb 3 19:55:19 2024 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=7ea11750
Revert "testAsyncFunctionStdin: multiprocessing spawn compat" This reverts commit 3b1234ba69a31709cd5aec1ae070901e3a28bb7c, since ForkProcess now solves the problem by creating temporary duplicate file descriptors. Bug: https://bugs.gentoo.org/916601 Signed-off-by: Zac Medico <zmedico <AT> gentoo.org> lib/portage/tests/process/test_AsyncFunction.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/lib/portage/tests/process/test_AsyncFunction.py b/lib/portage/tests/process/test_AsyncFunction.py index a056f268bd..eb426a5c02 100644 --- a/lib/portage/tests/process/test_AsyncFunction.py +++ b/lib/portage/tests/process/test_AsyncFunction.py @@ -1,4 +1,4 @@ -# Copyright 2020-2023 Gentoo Authors +# Copyright 2020-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 import functools @@ -44,20 +44,17 @@ class AsyncFunctionTestCase(TestCase): ), ) reader.start() - # For compatibility with the multiprocessing spawn start - # method, we delay restoration of the stdin file descriptor, - # since this file descriptor is sent to the subprocess - # asynchronously. - _set_nonblocking(pw.fileno()) - with open(pw.fileno(), mode="wb", buffering=0, closefd=False) as pipe_write: - await _writer(pipe_write, test_string.encode("utf_8")) - pw.close() - self.assertEqual((await reader.async_wait()), os.EX_OK) - self.assertEqual(reader.result, test_string) finally: os.dup2(stdin_backup, portage._get_stdin().fileno()) os.close(stdin_backup) + _set_nonblocking(pw.fileno()) + with open(pw.fileno(), mode="wb", buffering=0, closefd=False) as pipe_write: + await _writer(pipe_write, test_string.encode("utf_8")) + pw.close() + self.assertEqual((await reader.async_wait()), os.EX_OK) + self.assertEqual(reader.result, test_string) + def testAsyncFunctionStdin(self): loop = asyncio._wrap_loop() loop.run_until_complete(self._testAsyncFunctionStdin(loop=loop))
