We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2dc6bbe commit 2472b4fCopy full SHA for 2472b4f
1 file changed
tests/bootstrap.php
@@ -18,9 +18,20 @@
18
19
20
// create temporary directory
21
-define('TEMP_DIR', __DIR__ . '/tmp/' . getmypid());
22
-@mkdir(dirname(TEMP_DIR)); // @ - directory may already exist
23
-Tester\Helpers::purge(TEMP_DIR);
+(function () {
+ define('TEMP_DIR', __DIR__ . '/tmp/' . getmypid());
+
24
+ // garbage collector
25
+ $GLOBALS['\\lock'] = $lock = fopen(__DIR__ . '/lock', 'w');
26
+ if (rand(0, 100)) {
27
+ flock($lock, LOCK_SH);
28
+ @mkdir(dirname(TEMP_DIR));
29
+ } elseif (flock($lock, LOCK_EX)) {
30
+ Tester\Helpers::purge(dirname(TEMP_DIR));
31
+ }
32
33
+ @mkdir(TEMP_DIR);
34
+})();
35
36
37
if (extension_loaded('xdebug')) {
0 commit comments