8000 [Finder] Fixed filename containing space bug in gnu adapter. · govaniso/symfony@2817a47 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2817a47

Browse files
committed
[Finder] Fixed filename containing space bug in gnu adapter.
1 parent 9bf7cb0 commit 2817a47

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Symfony/Component/Finder/Adapter/GnuFindAdapter.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function searchInDirectory($dir)
8484
$this->buildDatesFiltering($find, $this->dates);
8585

8686
$useGrep = $this->shell->testCommand('grep') && $this->shell->testCommand('xargs');
87-
$useSort = is_int($this->sort) && $this->shell->testCommand('sort') && $this->shell->testCommand('awk');
87+
$useSort = is_int($this->sort) && $this->shell->testCommand('sort') && $this->shell->testCommand('cut');
8888

8989
if ($useGrep && ($this->contains || $this->notContains)) {
9090
$grep = $command->ins('grep');
@@ -286,8 +286,8 @@ private function buildSorting(Command $command, $sort)
286286
{
287287
switch ($sort) {
288288
case SortableIterator::SORT_BY_NAME:
289-
$format = null;
290-
break;
289+
$command->ins('sort')->add('| sort');
290+
return;
291291
case SortableIterator::SORT_BY_TYPE:
292292
$format = '%y';
293293
break;
@@ -306,6 +306,6 @@ private function buildSorting(Command $command, $sort)
306306

307307
$command->get('find')->add('-printf')->arg($format.' %h/%f\\n');
308308
$command->ins('sort')->add('| sort');
309-
$command->ins('awk')->add('| awk')->arg('{ print $'.(null === $format ? '1' : '2').' }');
309+
$command->ins('awk')->add('| cut')->arg('-d ')->arg('-f2-');
310310
}
311311
}

0 commit comments

Comments
 (0)
0