Allow using spin() from ProcessLogger even with no logger given.
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Tue, 23 Mar 2021 05:08:51 +0100
changeset 2733 244598a6a0d6
parent 2732 a3f0e4148714
child 2734 3768af52835a
Allow using spin() from ProcessLogger even with no logger given.
util/ProcessLogger.py
--- a/util/ProcessLogger.py	Wed Mar 10 09:59:18 2021 +0100
+++ b/util/ProcessLogger.py	Tue Mar 23 05:08:51 2021 +0100
@@ -239,11 +239,14 @@
 
     def spin(self):
         start = time.time()
-        while not self.finishsem.acquire(0):
-            with self.spinwakeuplock:
-                self.spinwakeuptimer = Timer(0.1, self.spinwakeup)
-                self.spinwakeuptimer.start()
-                self.spinwakeupcond.wait()
-            self.logger.progress("%.3fs"%(time.time() - start))
+        if self.logger:
+            while not self.finishsem.acquire(0):
+                with self.spinwakeuplock:
+                    self.spinwakeuptimer = Timer(0.1, self.spinwakeup)
+                    self.spinwakeuptimer.start()
+                    self.spinwakeupcond.wait()
+                    self.logger.progress("%.3fs"%(time.time() - start))
+        else:
+            self.finishsem.acquire()
 
         return [self.exitcode, "".join(self.outdata), "".join(self.errdata)]