graceful-send-echo.js
This file
Path
test/fixtures/graceful-send-echo.js
9 lines · 334 bytes · JavaScript
Last changed by
Require Node.js 22 (#1243)Sindre Sorhusbefore adoption04b4454
History of this fileTake it
12345678910#!/usr/bin/env nodeimport {onAbortedSignal} from '../helpers/graceful.js';import {getCancelSignal, getOneMessage, sendMessage} from 'execa';
const message = await getOneMessage();const cancelSignal = await getCancelSignal();await sendMessage(message);await onAbortedSignal(cancelSignal);await sendMessage(cancelSignal.reason);