fix(sigint): remove sigint handler early (#10266)

This commit is contained in:
Pavel Feldman 2021-11-11 17:14:36 -08:00 committed by GitHub
parent 7eec66d0f9
commit 8dcd77270f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -177,7 +177,6 @@ export async function showHTMLReport(reportFolder: string | undefined, testId?:
if (testId)
url += `#?testId=${testId}`;
open(url);
process.on('SIGINT', () => process.exit(0));
await new Promise(() => {});
}

View file

@ -290,6 +290,11 @@ export class Runner {
if (!list) {
const dispatcher = new Dispatcher(this._loader, testGroups, this._reporter);
await Promise.race([dispatcher.run(), sigIntPromise]);
if (!sigint) {
// We know for sure there was no Ctrl+C, so we remove custom SIGINT handler
// as soon as we can.
process.off('SIGINT', sigintHandler);
}
await dispatcher.stop();
hasWorkerErrors = dispatcher.hasWorkerErrors();
}