From 007e291befbf95eb9adc90a3e7195791adf47a31 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Thu, 23 Jan 2025 11:50:06 +0100 Subject: [PATCH] fix(terminal): terminal shows that it is not available, even though it is --- .../Project/Shared/ExecuteContainerCommand.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/Livewire/Project/Shared/ExecuteContainerCommand.php b/app/Livewire/Project/Shared/ExecuteContainerCommand.php index f993480c7..98289c536 100644 --- a/app/Livewire/Project/Shared/ExecuteContainerCommand.php +++ b/app/Livewire/Project/Shared/ExecuteContainerCommand.php @@ -146,11 +146,16 @@ class ExecuteContainerCommand extends Component private function checkShellAvailability(Server $server, string $container): bool { $escapedContainer = escapeshellarg($container); - $result = instant_remote_process([ - "docker exec {$escapedContainer} which bash || docker exec {$escapedContainer} which sh", - ], $server, false); + try { + instant_remote_process([ + "docker exec {$escapedContainer} bash -c 'exit 0' 2>/dev/null || ". + "docker exec {$escapedContainer} sh -c 'exit 0' 2>/dev/null", + ], $server); - return ! empty($result); + return true; + } catch (\Throwable) { + return false; + } } #[On('connectToServer')]