MCPcopy Create free account
hub / github.com/OpenHands/OpenHands / shutdown

Function shutdown

scripts/dev-extra-backend.mjs:175–189  ·  view source on GitHub ↗
(signal = "SIGTERM")

Source from the content-addressed store, hash-verified

173 let shuttingDown = false;
174
175 const shutdown = (signal = "SIGTERM") => {
176 if (shuttingDown) {
177 return;
178 }
179
180 shuttingDown = true;
181 signalProcessTree(backend, signal);
182
183 setTimeout(() => {
184 if (isProcessRunning(backend)) {
185 signalProcessTree(backend, "SIGKILL");
186 }
187 process.exit(process.exitCode ?? 0);
188 }, 3000);
189 };
190
191 process.on("SIGINT", () => shutdown("SIGINT"));
192 process.on("SIGTERM", () => shutdown("SIGTERM"));

Callers 1

mainFunction · 0.70

Calls 2

signalProcessTreeFunction · 0.90
isProcessRunningFunction · 0.90

Tested by

no test coverage detected