INNER CODE UNIT · JavaScript

handleSignal

containers/kubernetes-mcp-server · npm/kubernetes-mcp-server/bin/index.js:28

const handleSignal = () => (signal) => {
  // SIGHUP no longer terminates the child (it reloads with a config, ignores
  // without), but still forward it so `kill -HUP` on this parent can trigger a
  // reload. Just don't log it as a termination.
  if (signal === 'SIGHUP') {
    console.log(`Received ${signal}, forwarding to child process...`);
  } else {
    console.log(`Received ${signal}, terminating child process...`);
  }
  if (child && !child.killed) {
    child.kill(signal);
  }
};

['SIGTERM', 'SIGINT', 'SIGHUP'].forEach((signal) => {
  process.on(signal, handleSignal(signal));
});

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…