Skip to content

Commit 15bfb89

Browse files
authored
Prevent unnecessary copy if source equals target
Add check to ensure source and target paths are different before copying.
1 parent 5e362d3 commit 15bfb89

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

src/package/pie.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,8 @@ private function downloadLatestPiePhar(string $targetPath): void
106106
throw new \RuntimeException('PIE download did not produce expected file: ' . $downloaded);
107107
}
108108

109-
if (!@copy($downloaded, $targetPath)) {
109+
if ($downloaded !== $targetPath && !@copy($downloaded, $targetPath)) {
110110
throw new \RuntimeException('Failed to stage pie.phar to build directory.');
111111
}
112-
@chmod($targetPath, 0644);
113112
}
114113
}

0 commit comments

Comments
 (0)