MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / resolve_supervisor_bin

Function resolve_supervisor_bin

crates/openshell-driver-docker/src/lib.rs:3085–3110  ·  view source on GitHub ↗
(
    docker: &Docker,
    docker_config: &DockerComputeConfig,
    daemon_arch: &str,
)

Source from the content-addressed store, hash-verified

3083}
3084
3085pub(crate) async fn resolve_supervisor_bin(
3086 docker: &Docker,
3087 docker_config: &DockerComputeConfig,
3088 daemon_arch: &str,
3089) -> CoreResult<PathBuf> {
3090 let current_exe =
3091 if cfg!(target_os = "linux")
3092 && docker_config.supervisor_bin.is_none()
3093 && docker_config.supervisor_image.is_none()
3094 {
3095 Some(std::env::current_exe().map_err(|err| {
3096 Error::config(format!("failed to resolve current executable: {err}"))
3097 })?)
3098 } else {
3099 None
3100 };
3101 let target_candidates = linux_supervisor_candidates(daemon_arch);
3102
3103 match resolve_supervisor_bin_source(docker_config, current_exe.as_deref(), &target_candidates)?
3104 {
3105 SupervisorBinSource::Binary(path) => Ok(path),
3106 SupervisorBinSource::Image(image) => {
3107 extract_supervisor_bin_from_image(docker, &image).await
3108 }
3109 }
3110}
3111
3112fn linux_supervisor_candidates(daemon_arch: &str) -> Vec<PathBuf> {
3113 match daemon_arch {

Callers 1

newMethod · 0.85

Calls 4

configFunction · 0.85

Tested by

no test coverage detected