SIGN IN SIGN UP

[3.12] gh-109888: Fix test_os _kill_with_event() on Windows (GH-110421) (#110442)

gh-109888: Fix test_os _kill_with_event() on Windows (GH-110421)

Replace os.kill() with proc.kill() which catchs PermissionError.

Rewrite _kill_with_event():

* Use subprocess context manager ("with proc:").
* Use sleeping_retry() to wait until the child process is ready.
* Replace SIGINT with proc.kill() on error.
* Replace 10 seconds with SHORT_TIMEOUT to wait until the process is
  ready.
* Replace 0.5 seconds with SHORT_TIMEOUT to wait for the process
  exit.
(cherry picked from commit aaf297c048694cd9652790f8b74e69f7ddadfbde)

Co-authored-by: Victor Stinner <vstinner@python.org>
M
Miss Islington (bot) committed
6af359b088cc5cecb98add1302e2788d57a83011
Parent: 1b58985
Committed by GitHub <noreply@github.com> on 10/5/2023, 10:20:55 PM