free-games-claimer/test/sigint-enquirer-raw.js
nocci 7ffc454e47
Some checks failed
build-and-push / lint (push) Failing after 5s
build-and-push / sonar (push) Has been skipped
build-and-push / docker (push) Has been skipped
Clean up Sonar issues and lint warnings
2025-12-30 16:45:17 +00:00

18 lines
601 B
JavaScript

// https://github.com/enquirer/enquirer/issues/372
import { prompt, handleSIGINT } from '../src/util.js';
handleSIGINT();
console.log('hello');
console.error('hello error');
try {
const first = await prompt(); // SIGINT no longer handled if this is executed
const second = await prompt(); // SIGINT no longer handled if this is executed
console.log('values:', first, second);
setTimeout(() => console.log('timeout 3s'), 3000);
} catch (e) {
process.exitCode ||= 1;
console.log('catch. exitCode:', process.exitCode);
console.error(e);
}
console.log('end. exitCode:', process.exitCode);