From: Miodrag Milanovic Date: Wed, 15 Jan 2020 07:09:11 +0000 (+0100) Subject: Added sleep for non-posix, allow supported signals X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3fd0c73e657ca056c0a2a644faeb98df85671c01;p=SymbiYosys.git Added sleep for non-posix, allow supported signals --- diff --git a/sbysrc/sby_core.py b/sbysrc/sby_core.py index b01dc1e..5d41fd8 100644 --- a/sbysrc/sby_core.py +++ b/sbysrc/sby_core.py @@ -16,13 +16,13 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # -import os, re, sys +import os, re, sys, signal if os.name == "posix": - import resource, fcntl, signal + import resource, fcntl import subprocess from shutil import copyfile, rmtree from select import select -from time import time, localtime +from time import time, localtime, sleep all_tasks_running = [] @@ -34,8 +34,8 @@ def force_shutdown(signum, frame): if os.name == "posix": signal.signal(signal.SIGHUP, force_shutdown) - signal.signal(signal.SIGINT, force_shutdown) - signal.signal(signal.SIGTERM, force_shutdown) +signal.signal(signal.SIGINT, force_shutdown) +signal.signal(signal.SIGTERM, force_shutdown) def process_filename(filename): if filename.startswith("~/"): @@ -247,6 +247,8 @@ class SbyJob: select(fds, [], [], 1.0) == ([], [], []) except InterruptedError: pass + else: + sleep(0.1) for task in self.tasks_running: task.poll()