@iexec/iapp
Version:
A CLI to guide you through the process of building an iExec iApp
22 lines (21 loc) • 466 B
text/typescript
export function createSigintAbortSignal() {
const abortController = new AbortController();
function clearListener() {
process.off('SIGINT', handleAbort);
}
function handleAbort() {
abortController.abort();
clearListener();
}
process.on('SIGINT', handleAbort);
return {
/**
* AbortSignal trigged by SIGINT
*/
signal: abortController.signal,
/**
* clear the SIGINT listener
*/
clear: clearListener,
};
}