lint-staged
Version:
Lint files staged by git
19 lines (15 loc) • 411 B
JavaScript
export const Signal = {
SIGINT: 'SIGINT',
SIGKILL: 'SIGKILL',
}
/**
* Get an AbortController used to cancel running tasks on failure/interruption.
* @returns AbortController
*/
export const getAbortController = (nodeProcess = process) => {
const abortController = new AbortController()
nodeProcess.on(Signal.SIGINT, () => {
abortController.abort(Signal.SIGINT)
})
return abortController
}