diff --git a/robyn/dev_event_handler.py b/robyn/dev_event_handler.py index c22dd541c..d07dd3ad1 100644 --- a/robyn/dev_event_handler.py +++ b/robyn/dev_event_handler.py @@ -1,4 +1,5 @@ import subprocess +import sys from watchdog.events import FileSystemEventHandler @@ -7,11 +8,14 @@ class EventHandler(FileSystemEventHandler): def __init__(self, file_name) -> None: self.file_name = file_name self.processes = [] + self.alias = "python3" if not sys.platform.startswith("win32") else "python" + self.shell = True if sys.platform.startswith("win32") else False + def start_server_first_time(self) -> None: if self.processes: raise Exception("Something wrong with the server") - self.processes.append(subprocess.Popen(["python3", self.file_name], start_new_session=False)) + self.processes.append(subprocess.Popen([self.alias, self.file_name], shell = self.shell, start_new_session=False)) def on_any_event(self, event) -> None: """ @@ -22,5 +26,5 @@ def on_any_event(self, event) -> None: if len(self.processes) > 0: for process in self.processes: - process.terminate() - self.processes.append(subprocess.Popen(["python3", self.file_name], start_new_session=False)) + process.terminate() + self.processes.append(subprocess.Popen([self.alias, self.file_name], shell = self.shell, start_new_session=False))