Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Server/Property.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
final class Property
{
const bin_dir = 'bin_dir';
const command_decorator = 'command_decorator';
const config_dir = 'config_dir';
const console_bin = 'console_bin';
const cache_dir = 'cache_dir';
Expand Down
9 changes: 9 additions & 0 deletions src/Task/TaskRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ private function doRun(Server $server, string $shellCommand, array $envVars): Ta
$shellCommand = sprintf('(export %s; %s)', $envVarsAsString, $shellCommand);
}

if ($server->has(Property::command_decorator)) {
$shellCommand = $this->applyCommandDecorator($server->get(Property::command_decorator), $server, $shellCommand, $envVars);
}

$this->logger->log(sprintf('[<server>%s</>] Executing command: <command>%s</>', $server, $shellCommand));

if ($this->isDryRun) {
Expand All @@ -80,4 +84,9 @@ private function doRun(Server $server, string $shellCommand, array $envVars): Ta

return new TaskCompleted($server, $process->getOutput(), $process->getExitCode());
}

private function applyCommandDecorator(callable $decorator, Server $server, string $shellCommand, array $envVars): string
{
return $decorator($server, $shellCommand, $envVars);
}
}