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 845257f commit c8e0c8eCopy full SHA for c8e0c8e
1 file changed
tests/bootstrap.php
@@ -16,9 +16,22 @@
16
17
18
// create temporary directory
19
-define('TEMP_DIR', __DIR__ . '/tmp/' . getmypid());
20
-@mkdir(dirname(TEMP_DIR)); // @ - directory may already exist
21
-Tester\Helpers::purge(TEMP_DIR);
+(function () {
+ define('TEMP_DIR', __DIR__ . '/tmp/' . getmypid());
+
22
+ // garbage collector
23
+ $GLOBALS['\\lock'] = $lock = fopen(__DIR__ . '/lock', 'w');
24
+ if (rand(0, 100)) {
25
+ flock($lock, LOCK_SH);
26
+ @mkdir(dirname(TEMP_DIR));
27
+ } elseif (flock($lock, LOCK_EX)) {
28
+ Tester\Helpers::purge(dirname(TEMP_DIR));
29
+ }
30
31
+ @mkdir(TEMP_DIR);
32
+})();
33
34
35
ini_set('session.save_path', TEMP_DIR);
36
37
0 commit comments