| 85 | self.process.start() |
| 86 | |
| 87 | def restart(self) -> None: |
| 88 | if sys.platform == "win32": # pragma: py-not-win32 |
| 89 | self.is_restarting = True |
| 90 | assert self.process.pid is not None |
| 91 | os.kill(self.process.pid, signal.CTRL_C_EVENT) |
| 92 | |
| 93 | # This is a workaround to ensure the Ctrl+C event is processed |
| 94 | sys.stdout.write(" ") # This has to be a non-empty string |
| 95 | sys.stdout.flush() |
| 96 | else: # pragma: py-win32 |
| 97 | self.process.terminate() |
| 98 | self.process.join() |
| 99 | |
| 100 | self.process = get_subprocess(config=self.config, target=self.target, sockets=self.sockets) |
| 101 | self.process.start() |
| 102 | |
| 103 | def shutdown(self) -> None: |
| 104 | if sys.platform == "win32": |