Skip to content

Commit 82fa04c

Browse files
authored
Merge pull request #6 from petrknap/internal-refactoring
Pipelines switched to native shell pipelines
2 parents d728dd2 + 70e8bae commit 82fa04c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Filter.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,20 @@ private static function checkFinishedProcess(Process $finishedProcess): void
112112
private static function transformPipeline(array $pipeline): array
113113
{
114114
$transformedPipeline = [];
115+
$shellCommandLine = null;
115116
foreach ($pipeline as $filter) {
116117
if ($filter instanceof self) {
117-
$transformedPipeline[] = new Process([
118+
$shellCommandLine = ($shellCommandLine === null ? '' : "{$shellCommandLine} | ") . (new Process([
118119
$filter->command,
119120
...($filter->options ?? []),
120-
]);
121+
]))->getCommandLine();
121122
} else {
122123
throw new \BadMethodCallException('$pipeline contains unsupported filter');
123124
}
124125
}
126+
if ($shellCommandLine !== null) {
127+
$transformedPipeline[] = Process::fromShellCommandline($shellCommandLine);
128+
}
125129
return $transformedPipeline;
126130
}
127131
}

0 commit comments

Comments
 (0)