mirror of
https://github.com/hanzoai/lint-staged.git
synced 2026-10-30 19:37:36 +00:00
19 lines
411 B
JavaScript
19 lines
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
|
|
}
|