# HG changeset patch # User Edouard Tisserant # Date 1616472531 -3600 # Node ID 8df40690efb07a85c240c758ec5f72fe9db77193 # Parent 26b7c4aa7b3844f3a2691e01696208cfa304b4d0 Allow using spin() from ProcessLogger even with no logger given. diff -r 26b7c4aa7b38 -r 8df40690efb0 util/ProcessLogger.py --- a/util/ProcessLogger.py Wed Mar 17 11:07:29 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)]