import { Kubectl } from "../kubectl" ; import { ExecResult } from "../binutilplusplus" ; async function isBashOnContainer ( kubectl , podName , podNamespace , containerName ) { const nsarg = podNamespace ? `--namespace ${ podNamespace }` : '' ; const containerCommand = containerName ? `-c ${ containerName }` : '' ; const result = await kubectl . invokeCommand ( `exec ${ podName } ${ nsarg } ${ containerCommand } -- ls -la /bin/bash` ) ; return ExecResult . succeeded ( result ) ; } export async function suggestedShellForContainer ( kubectl , podName , podNamespace , containerName ) { if ( await isBashOnContainer ( kubectl , podName , podNamespace , containerName ) ) { return 'bash' ; } return 'sh' ; }