MCPcopy Create free account
hub / github.com/delinoio/oss / for_linked_runtime

Method for_linked_runtime

crates/nodeup/src/command_diagnostics.rs:87–122  ·  view source on GitHub ↗
(
        name: &str,
        runtime_root: &Path,
        command: &str,
        install_on_demand_eligible: bool,
    )

Source from the content-addressed store, hash-verified

85 }
86
87 pub fn for_linked_runtime(
88 name: &str,
89 runtime_root: &Path,
90 command: &str,
91 install_on_demand_eligible: bool,
92 ) -> Self {
93 let checked_path_values = runtime_executable_candidate_paths(runtime_root, command);
94 let selected_path = selected_existing_or_primary(&checked_path_values);
95 let direct_executable_exists = selected_path.exists();
96 let direct_executable_runnable = runtime_executable_is_runnable(&selected_path);
97 let npm_exec_fallback =
98 npm_exec_fallback_for_command(Some(runtime_root), command, direct_executable_exists);
99
100 Self {
101 command: command.to_string(),
102 runtime: name.to_string(),
103 linked_runtime_name: Some(name.to_string()),
104 linked_runtime_path: Some(runtime_root.display().to_string()),
105 checked_paths: checked_path_values
106 .iter()
107 .map(|path| path.display().to_string())
108 .collect(),
109 selected_path: selected_path.display().to_string(),
110 direct_executable_exists,
111 direct_executable_runnable,
112 managed_shim_available: direct_executable_runnable || npm_exec_fallback.is_some(),
113 availability_mode: availability_mode(direct_executable_runnable, &npm_exec_fallback)
114 .to_string(),
115 delegated_executable_path: npm_exec_fallback
116 .as_ref()
117 .map(|path| path.display().to_string()),
118 install_on_demand_eligible,
119 install_on_demand_scope: "linked-runtime".to_string(),
120 path_precedence_guidance: PATH_PRECEDENCE_GUIDANCE,
121 }
122 }
123
124 pub fn into_error_diagnostics(self) -> ErrorDiagnostics {
125 let mut diagnostics = ErrorDiagnostics::new();

Callers

nothing calls this directly

Tested by

no test coverage detected