graceful-disconnect.js
This file
Path
test/fixtures/graceful-disconnect.js
12 lines · 371 bytes · JavaScript
Last changed by
Require Node.js 22 (#1243)Sindre Sorhusbefore adoption04b4454
History of this fileTake it
Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5
lines 1–4why, one step back1#!/usr/bin/env node2import process from 'node:process';3import {once} from 'node:events';4import {onAbortedSignal} from '../helpers/graceful.js';Require Node.js 22 (#1243)Sindre Sorhusbefore adoption04b4454
line 5why, one step back5import {getCancelSignal, sendMessage} from 'execa';Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5
lines 6–12why, one step back67const cancelSignal = await getCancelSignal();8await onAbortedSignal(cancelSignal);9await Promise.all([10 once(process, 'disconnect'),11 sendMessage(cancelSignal.reason),12]);