Skip to content

Commit 319907b

Browse files
authored
Merge pull request #6833 from LeMyst/patch-1
fix: `composer update` might cause error "Failed to open directory"
2 parents 98178a1 + 204a76a commit 319907b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

system/ComposerScripts.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ public static function postUpdate()
8787
private static function recursiveDelete(string $directory): void
8888
{
8989
if (! is_dir($directory)) {
90-
echo sprintf('Cannot recursively delete "%s" as it does not exist.', $directory);
90+
echo sprintf('Cannot recursively delete "%s" as it does not exist.', $directory) . PHP_EOL;
91+
92+
return;
9193
}
9294

9395
/** @var SplFileInfo $file */
@@ -126,7 +128,11 @@ private static function recursiveMirror(string $originDir, string $targetDir): v
126128
exit(1);
127129
}
128130

129-
@mkdir($targetDir, 0755, true);
131+
if (! @mkdir($targetDir, 0755, true)) {
132+
echo sprintf('Cannot create the target directory: "%s"', $targetDir) . PHP_EOL;
133+
134+
exit(1);
135+
}
130136

131137
$dirLen = strlen($originDir);
132138

0 commit comments

Comments
 (0)