Skip to content

Commit 54f4874

Browse files
committed
kill test process using ctrl_c_event on windows
1 parent e8d3d38 commit 54f4874

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

mypy/test/testdaemon.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -202,18 +202,17 @@ def test_watcher_reacts_to_file_changes(self) -> None:
202202
def tearDown(self) -> None:
203203
subprocess.run([sys.executable, "-m", "mypy.dmypy", "stop"], cwd=self.temp_path)
204204

205-
# Send SIGINT to terminate the watcher process
206205
if self.process.poll() is None:
207-
self.process.send_signal(signal.SIGINT)
206+
self.process.send_signal(
207+
signal.CTRL_C_EVENT if sys.platform == "win32" else signal.SIGINT
208+
)
208209
try:
209210
self.process.wait(timeout=5)
210211
except subprocess.TimeoutExpired:
211212
self.process.kill()
212213

213-
# Stop the output reader thread
214214
self.stop_reader = True
215215
if self.reader_thread.is_alive():
216216
self.reader_thread.join(timeout=5)
217217

218-
# Clean up temp directory
219218
self.temp_dir.cleanup()

0 commit comments

Comments
 (0)