From d1b474962d7a5c618f86cd93d99a44290561a4e8 Mon Sep 17 00:00:00 2001 From: Matthew Stratford Date: Sun, 1 Nov 2020 01:36:42 +0000 Subject: [PATCH] Only set multiprocessing to spawn for MacOS. --- server.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/server.py b/server.py index a3536fc..ed9d832 100644 --- a/server.py +++ b/server.py @@ -5,7 +5,7 @@ import json import sounddevice as sd import setproctitle import logging -import sys +from helpers.os_environment import isMacOS setproctitle.setproctitle("BAPSicle - Server") @@ -30,6 +30,7 @@ channel_p = [] stopping = False + @app.errorhandler(404) def page_not_found(e): data = { @@ -154,6 +155,7 @@ def status(channel): return response + @app.route("/quit") def quit(): stopServer() @@ -173,7 +175,8 @@ def send_static(path): def startServer(): - multiprocessing.set_start_method("spawn", True) + if isMacOS(): + multiprocessing.set_start_method("spawn", True) for channel in range(3): channel_to_q.append(multiprocessing.Queue()) @@ -200,7 +203,7 @@ def stopServer(): player.join() except: pass - print ("Stopped all players.") + print("Stopped all players.") global stopping if stopping == False: stopping = True