Skip to main content

select_image_for_command

Function select_image_for_command 

Source
pub fn select_image_for_command(
    command: &SandboxCommand,
    language_images: &HashMap<String, String>,
    default_image: &str,
) -> String
Expand description

为命令选择合适的镜像(通用逻辑)。

按优先级:语言精确匹配 -> 语言前缀匹配 -> 默认镜像。 对 CommandKind::Shell,如果首个 token 看起来像路径(包含 /\), 则直接回退到默认镜像,避免把宿主机路径误判成语言标识。