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

Function shutdown

scripts/dev-safe.mjs:910–930  ·  view source on GitHub ↗
(signal = "SIGTERM")

Source from the content-addressed store, hash-verified

908 let frontend = null;
909
910 const shutdown = (signal = "SIGTERM") => {
911 if (shuttingDown) {
912 return;
913 }
914
915 shuttingDown = true;
916 if (frontend) {
917 signalProcessTree(frontend, signal);
918 }
919 signalProcessTree(backend, signal);
920
921 setTimeout(() => {
922 if (frontend && isProcessRunning(frontend)) {
923 signalProcessTree(frontend, "SIGKILL");
924 }
925 if (isProcessRunning(backend)) {
926 signalProcessTree(backend, "SIGKILL");
927 }
928 process.exit(process.exitCode ?? 0);
929 }, 3000);
930 };
931
932 process.on("SIGINT", () => shutdown("SIGINT"));
933 process.on("SIGTERM", () => shutdown("SIGTERM"));

Callers 1

mainFunction · 0.70

Calls 2

signalProcessTreeFunction · 0.90
isProcessRunningFunction · 0.90

Tested by

no test coverage detected