Support Windows 7 with Python 3.8

This commit is contained in:
hz
2026-09-27 14:23:47 -05:00
parent 005ad5a2eb
commit 48500792ce
3 changed files with 34 additions and 3 deletions
+6 -2
View File
@@ -1,4 +1,4 @@
"""Windows ping spike monitor. Python 3.10+, standard library only."""
"""Windows ping spike monitor. Python 3.8+, standard library only."""
from __future__ import annotations
import argparse
@@ -376,7 +376,11 @@ def main():
log.write("error", f"Error: {error}", error=str(error))
finally:
stop.set()
executor.shutdown(wait=True, cancel_futures=True)
# Python 3.8 has no shutdown(cancel_futures=...). There is at most
# one submitted trace; cancel it if queued, or let stop end it if running.
if pending is not None:
pending.cancel()
executor.shutdown(wait=True)
log.write("stop", "Monitor stopped.", samples=samples)
log.file.close()
return 1 if failed else 0