Fix sby execution on Windows
authorMiodrag Milanovic <mmicko@gmail.com>
Sun, 17 Nov 2019 15:58:35 +0000 (16:58 +0100)
committerMiodrag Milanovic <mmicko@gmail.com>
Sun, 17 Nov 2019 15:58:35 +0000 (16:58 +0100)
sbysrc/sby_core.py

index 98f40325f18f5d51c5f0dc63bcb04ac731b16feb..b01dc1edc7cdc627206928c294fb89277bff9927 100644 (file)
@@ -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("~/"):
@@ -242,10 +242,11 @@ class SbyJob:
                 if task.running:
                     fds.append(task.p.stdout)
 
-            try:
-                select(fds, [], [], 1.0) == ([], [], [])
-            except InterruptedError:
-                pass
+            if os.name == "posix":
+                try:
+                    select(fds, [], [], 1.0) == ([], [], [])
+                except InterruptedError:
+                    pass
 
             for task in self.tasks_running:
                 task.poll()