This commit is contained in:
Shreyas Goenka 2025-03-02 17:06:24 +01:00
parent 8213c4fa22
commit 0e300c6a40
No known key found for this signature in database
GPG Key ID: 92A07DF49CCB0622
1 changed files with 4 additions and 2 deletions

View File

@ -5,11 +5,12 @@ import time
import platform
import subprocess
def is_finished_windows(pid):
assert int(pid) > 0
# Run task list but filter the list by pid..
output = subprocess.check_output(f"tasklist /fi \"PID eq {pid}\"", text=True)
output = subprocess.check_output(f'tasklist /fi "PID eq {pid}"', text=True)
# If tasklist does not find any process, that means the process we are
# waiting for has terminated.
@ -19,6 +20,7 @@ def is_finished_windows(pid):
return False
def is_finished_unix(pid):
assert int(pid) > 0
@ -54,9 +56,9 @@ def wait_pid(pid):
time.sleep(sleep_time)
print(f"Timeout: Process {pid} did not end within 1 minute")
return 1
exit_code = wait_pid(int(sys.argv[1]))
sys.exit(exit_code)