mirror of
https://github.com/python/cpython.git
synced 2025-08-09 19:38:42 +00:00
[3.12] gh-110036: multiprocessing Popen.terminate() catches PermissionError (GH-110037) (#110064)
gh-110036: multiprocessing Popen.terminate() catches PermissionError (GH-110037)
On Windows, multiprocessing Popen.terminate() now catchs
PermissionError and get the process exit code. If the process is
still running, raise again the PermissionError. Otherwise, the
process terminated as expected: store its exit code.
(cherry picked from commit bd4518c60c
)
Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
aaa8bf18c6
commit
a2074911ba
3 changed files with 17 additions and 4 deletions
|
@ -557,13 +557,14 @@ class _TestProcess(BaseTestCase):
|
|||
|
||||
def test_terminate(self):
|
||||
exitcode = self._kill_process(multiprocessing.Process.terminate)
|
||||
if os.name != 'nt':
|
||||
self.assertEqual(exitcode, -signal.SIGTERM)
|
||||
self.assertEqual(exitcode, -signal.SIGTERM)
|
||||
|
||||
def test_kill(self):
|
||||
exitcode = self._kill_process(multiprocessing.Process.kill)
|
||||
if os.name != 'nt':
|
||||
self.assertEqual(exitcode, -signal.SIGKILL)
|
||||
else:
|
||||
self.assertEqual(exitcode, -signal.SIGTERM)
|
||||
|
||||
def test_cpu_count(self):
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue