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

Method terminate

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

Source from the content-addressed store, hash-verified

73 self.process.start()
74
75 def terminate(self) -> None:
76 if self.process.exitcode is None: # Process is still running
77 assert self.process.pid is not None
78 if os.name == "nt": # pragma: py-not-win32
79 # Windows doesn't support SIGTERM.
80 # So send SIGBREAK, and then in process raise SIGTERM.
81 os.kill(self.process.pid, signal.CTRL_BREAK_EVENT) # type: ignore[attr-defined]
82 else:
83 os.kill(self.process.pid, signal.SIGTERM)
84 logger.info(f"Terminated child process [{self.process.pid}]")
85
86 self.parent_conn.close()
87 self.child_conn.close()
88
89 def kill(self) -> None:
90 # In Windows, the method will call `TerminateProcess` to kill the process.

Callers 5

terminate_allMethod · 0.80
restart_allMethod · 0.80
handle_ttouMethod · 0.80
restartMethod · 0.80
shutdownMethod · 0.80

Calls 2

killMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected