18 lines
601 B
JavaScript
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);
|