Skip to content

Commit 57a0458

Browse files
authored
Avoid a file exists error instead of supressing it
Suppressing the mkdir error causes a lot of noise in symfony dev logs if there are multiple files in a subdirectory of the tar file. Skip trying to create the subdirectory if it already exists.
1 parent 2bdf379 commit 57a0458

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Tar.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,9 @@ public function extract($outdir, $strip = '', $exclude = '', $include = '')
166166
// create output directory
167167
$output = $outdir.'/'.$fileinfo->getPath();
168168
$directory = ($fileinfo->getIsdir()) ? $output : dirname($output);
169-
@mkdir($directory, 0777, true);
169+
if (!file_exists($directory)) {
170+
mkdir($directory, 0777, true);
171+
}
170172

171173
// extract data
172174
if (!$fileinfo->getIsdir()) {

0 commit comments

Comments
 (0)