MCPcopy
hub / github.com/encode/uvicorn / restart

Method restart

uvicorn/supervisors/basereload.py:87–101  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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":

Callers 1

runMethod · 0.95

Calls 6

get_subprocessFunction · 0.90
killMethod · 0.80
terminateMethod · 0.80
joinMethod · 0.80
startMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected