Skip to content
Myr

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 file

Take it

Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5

lines 1–4why, one step back
1#!/usr/bin/env node
2import 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 back
5import {getCancelSignal, sendMessage} from 'execa';

Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5

lines 6–12why, one step back
6
7const cancelSignal = await getCancelSignal();8await onAbortedSignal(cancelSignal);9await Promise.all([10 once(process, 'disconnect'),11 sendMessage(cancelSignal.reason),12]);