fix(terminal): terminal shows that it is not available, even though it is

This commit is contained in:
peaklabs-dev
2025-01-23 11:50:06 +01:00
parent 1b62e1f117
commit 007e291bef

View File

@@ -146,11 +146,16 @@ class ExecuteContainerCommand extends Component
private function checkShellAvailability(Server $server, string $container): bool private function checkShellAvailability(Server $server, string $container): bool
{ {
$escapedContainer = escapeshellarg($container); $escapedContainer = escapeshellarg($container);
$result = instant_remote_process([ try {
"docker exec {$escapedContainer} which bash || docker exec {$escapedContainer} which sh", instant_remote_process([
], $server, false); "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')] #[On('connectToServer')]