diff --git a/src/Transport/CustomTransport.php b/src/Transport/CustomTransport.php index 7d74b5f..5f897b5 100644 --- a/src/Transport/CustomTransport.php +++ b/src/Transport/CustomTransport.php @@ -35,13 +35,14 @@ public function configure(SiteProcess $process) */ public function wrap($args) { - $transport = Shell::preEscaped($this->siteAlias->get('custom.command', '')); + $cmd = $this->siteAlias->get('custom.command', ''); + $transport = $cmd ? [Shell::preEscaped($cmd)] : []; $commandToExecute = $this->getCommandToExecute($args); - return array_merge( + return array_filter(array_merge( $transport, $commandToExecute - ); + )); } /** diff --git a/tests/Transport/CustomTransportTest.php b/tests/Transport/CustomTransportTest.php index 72351fb..1dc477a 100644 --- a/tests/Transport/CustomTransportTest.php +++ b/tests/Transport/CustomTransportTest.php @@ -47,8 +47,8 @@ public function wrapTestValues() public function testWrap($expected, $siteAliasData) { $siteAlias = new SiteAlias($siteAliasData, '@alias.dev'); - $dockerTransport = new CustomTransport($siteAlias); - $actual = $dockerTransport->wrap(['ls']); + $customTransport = new CustomTransport($siteAlias); + $actual = $customTransport->wrap(['ls']); $this->assertEquals($expected, implode(' ', $actual)); } }