askme-cli
Version:
askme-cli MCP server that collects user's next plan or confirmation through terminal window
22 lines • 779 B
JavaScript
import { useEffect } from 'react';
import { DELAYS } from '../../shared/utils/constants.js';
// Setup process exit protection
export const useExitProtection = () => {
useEffect(() => {
let forceExitTimer;
const handleExit = () => {
forceExitTimer = setTimeout(() => {
process.exit(0);
}, DELAYS.EXIT_PROTECTION);
};
const signals = ['SIGTERM', 'SIGINT', 'SIGHUP'];
signals.forEach(signal => process.on(signal, handleExit));
return () => {
if (forceExitTimer) {
clearTimeout(forceExitTimer);
}
signals.forEach(signal => process.removeListener(signal, handleExit));
};
}, []);
};
//# sourceMappingURL=useExitProtection.js.map