diff --git a/src/Console/Commands/DevPullCommand.php b/src/Console/Commands/DevPullCommand.php index 370585d8..84e1620b 100644 --- a/src/Console/Commands/DevPullCommand.php +++ b/src/Console/Commands/DevPullCommand.php @@ -272,7 +272,13 @@ private function replaceVendorFiles(string $noturRoot, string $sourcePath): void if (!is_dir($tmpPreserve)) { mkdir($tmpPreserve, 0755, true); } - rename($dirPath, $tmpPreserve . '/' . $dir); + $tmpDest = $tmpPreserve . '/' . $dir; + if (!rename($dirPath, $tmpDest)) { + throw new \RuntimeException( + "Failed to preserve directory: {$dirPath} to {$tmpDest}. " . + "Check permissions and ensure the directory is not locked." + ); + } } } @@ -292,7 +298,12 @@ private function replaceVendorFiles(string $noturRoot, string $sourcePath): void if (is_dir($destPath)) { $this->deleteDirectory($destPath); } - rename($tmpSource, $destPath); + if (!rename($tmpSource, $destPath)) { + throw new \RuntimeException( + "Failed to restore directory: {$tmpSource} to {$destPath}. " . + "Check permissions and ensure the directory is not locked." + ); + } } }