From cc07d0f1e4363547fbeddf694ec98d6da3f994a4 Mon Sep 17 00:00:00 2001 From: hw Date: Thu, 3 Feb 2022 18:38:38 -0500 Subject: [PATCH] fix: Shell object is not an array --- src/Transport/CustomTransport.php | 7 ++++--- tests/Transport/CustomTransportTest.php | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) 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)); } }