mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
fix: do not subscribe to SIGINT signal unless lock is acquired (#19978)
Subscription to SIGINT handler removes default handler. Fixes #19418
This commit is contained in:
parent
6022a4098f
commit
9943bcfcd8
@ -382,15 +382,23 @@ function toPromise(method) {
|
||||
|
||||
// Remove acquired locks on exit
|
||||
/* istanbul ignore next */
|
||||
onExit(() => {
|
||||
for (const file in locks) {
|
||||
const options = locks[file].options;
|
||||
|
||||
try { options.fs.rmdirSync(getLockFile(file, options)); } catch (e) { /* Empty */ }
|
||||
let cleanupInitialized = false;
|
||||
function ensureCleanup() {
|
||||
if (cleanupInitialized) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
cleanupInitialized = true;
|
||||
onExit(() => {
|
||||
for (const file in locks) {
|
||||
const options = locks[file].options;
|
||||
|
||||
try { options.fs.rmdirSync(getLockFile(file, options)); } catch (e) { /* Empty */ }
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
module.exports.lock = async (file, options) => {
|
||||
ensureCleanup();
|
||||
const release = await toPromise(lock)(file, options);
|
||||
return toPromise(release);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user