# HG changeset patch
# User Edouard Tisserant <edouard.tisserant@gmail.com>
# Date 1696862579 -7200
# Node ID 3e434edfbfdfbb3a20bd3228f301b425e91d9f67
# Parent  b076f52bd1c8069ed156d5721cf2e08f3dd860b3
SVGHMI: Fix watchdog exception on windows

diff -r b076f52bd1c8 -r 3e434edfbfdf svghmi/svghmi_server.py
--- a/svghmi/svghmi_server.py	Mon Oct 09 16:42:11 2023 +0200
+++ b/svghmi/svghmi_server.py	Mon Oct 09 16:42:59 2023 +0200
@@ -307,15 +307,15 @@
 def waitpid_timeout(proc, helpstr="", timeout = 3):
     if proc is None:
         return
-    def waitpid_timeout_loop(pid=proc.pid, timeout = timeout):
+    def waitpid_timeout_loop(proc = proc, timeout = timeout):
         try:
-            while os.waitpid(pid,os.WNOHANG) == (0,0):
+            while proc.poll() is None:
                 time.sleep(1)
                 timeout = timeout - 1
                 if not timeout:
                     GetPLCObjectSingleton().LogMessage(
                         LogLevelsDict["WARNING"], 
-                        "Timeout waiting for {} PID: {}".format(helpstr, str(pid)))
+                        "Timeout waiting for {} PID: {}".format(helpstr, str(proc.pid)))
                     break
         except OSError:
             # workaround exception "OSError: [Errno 10] No child processes"