Skip to content
Myr

graceful-none-twice.js

This file

Path

test/fixtures/graceful-none-twice.js

14 lines · 527 bytes · JavaScript

Last changed by

TweaksSindre Sorhusbefore adoption698a1b8

History of this file

Take it

Harden some thingsSindre Sorhusbefore adoption4a0a121

lines 1–5why, one step back
1#!/usr/bin/env node
2import process from 'node:process';3import {getCancelSignal} from 'execa';45// Each call must throw the same error, including when the first one is caught and retried

TweaksSindre Sorhusbefore adoption698a1b8

line 6why, one step back
6// The calls are sequential on purpose, so the second one is retried after the first one was caught

Harden some thingsSindre Sorhusbefore adoption4a0a121

lines 7–8why, one step back
7for (let index = 0; index < 2; index++) {
8 try {

TweaksSindre Sorhusbefore adoption698a1b8

line 9why, one step back
9 // eslint-disable-next-line no-await-in-loop -- the second call is retried only after the first one was caught

Harden some thingsSindre Sorhusbefore adoption4a0a121

lines 10–14why, one step back
10 await getCancelSignal();
11 } catch {12 process.stdout.write('threw\n');13 }14}