Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
fix: do not subscribe to SIGINT signal unless lock is acquired (#19978)
Andrey Lushnikov9943bcfcd862
diff --git a/packages/playwright-core/bundles/utils/src/third_party/lockfile.js b/packages/playwright-core/bundles/utils/src/third_party/lockfile.jsindex c7e2f196f4..e72438cd4c 100644--- a/packages/playwright-core/bundles/utils/src/third_party/lockfile.js+++ b/packages/playwright-core/bundles/utils/src/third_party/lockfile.js@@ -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);}