Tests: use SID+KILL for sikuli subprocesses
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Tue, 01 Aug 2023 21:02:08 +0200
changeset 3839 a466d4468d7a
parent 3838 60d6e4396876
child 3840 c2b6354f036f
Tests: use SID+KILL for sikuli subprocesses
tests/ide_tests/sikuliberemiz.py
--- a/tests/ide_tests/sikuliberemiz.py	Tue Aug 01 21:00:11 2023 +0200
+++ b/tests/ide_tests/sikuliberemiz.py	Tue Aug 01 21:02:08 2023 +0200
@@ -229,7 +229,7 @@
   <body>
 """)
 
-        command = [python_bin, opj(beremiz_path,"Beremiz.py"), "--log=/dev/stdout"]
+        command = ["setsid", python_bin, opj(beremiz_path,"Beremiz.py"), "--log=/dev/stdout"]
 
         if exemple is not None:
             command.append(opj(beremiz_path,"exemples",exemple))
@@ -349,7 +349,7 @@
     def close(self):
 
         self.ReportScreenShot("Close app")
-        os.kill(self.proc.pid, signal.SIGTERM)
+        os.kill(self.proc.pid, signal.SIGKILL)
         #self.sikuliapp.close()
         #self.sikuliapp = None
 
@@ -371,6 +371,7 @@
     def ReportTextImage(self, msg, img):
         elapsed = "%.3fs: "%(timesec() - self.starttime)
         fname = "capture"+str(self.imgnum)+".png"
+        sys.stdout.write(elapsed + " [" + fname + "] " + msg + "\n")
         img.save(".", fname)
         self.imgnum = self.imgnum + 1
         self.report.write( "<p>" + escape(elapsed + msg) + "<br/><img src=\""+ fname + "\"/>" + "</p>")
@@ -378,6 +379,7 @@
     def ReportText(self, text):
         elapsed = "%.3fs: "%(timesec() - self.starttime)
         #res = u"<p><![CDATA[" + elapsed + text + "]]></p>"
+        sys.stdout.write(elapsed + text + "\n")
         res = u"<p>" + escape(elapsed + text) + "</p>"
         self.report.write(res)