about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMarcoIeni <11428655+MarcoIeni@users.noreply.github.com>2025-08-18 10:47:22 +0200
committerMarcoIeni <11428655+MarcoIeni@users.noreply.github.com>2025-08-18 10:47:22 +0200
commit4f7248207c59075a0aa203b1b6e9bfb67ef93d52 (patch)
tree2341c85b62c8fa418525e9aadb8ecbd2a59cfd3a
parent425a9c0a0e365c0b8c6cfd00c2ded83a73bed9a0 (diff)
downloadrust-4f7248207c59075a0aa203b1b6e9bfb67ef93d52.tar.gz
rust-4f7248207c59075a0aa203b1b6e9bfb67ef93d52.zip
ci: add timeout to windows disk cleanup wait
-rw-r--r--src/ci/scripts/free-disk-space-windows-wait.py21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/ci/scripts/free-disk-space-windows-wait.py b/src/ci/scripts/free-disk-space-windows-wait.py
index b8612bb71c2..d510781d534 100644
--- a/src/ci/scripts/free-disk-space-windows-wait.py
+++ b/src/ci/scripts/free-disk-space-windows-wait.py
@@ -61,12 +61,27 @@ def read_pid_from_file() -> int:
         ) from e
 
 
-def main() -> int:
-    pid = read_pid_from_file()
+def wait_for_process(pid: int):
+    timeout_duration_seconds = 5 * 60
+    interval_seconds = 3
+    max_attempts = timeout_duration_seconds / interval_seconds
+    attempts = 0
 
     # Poll until process exits
     while is_process_running(pid):
-        time.sleep(3)
+        if attempts >= max_attempts:
+            print(
+                "::warning::Timeout expired while waiting for the disk cleanup process to finish."
+            )
+            break
+        time.sleep(interval_seconds)
+        attempts += 1
+
+
+def main() -> int:
+    pid = read_pid_from_file()
+
+    wait_for_process(pid)
 
     print_logs()