Skip to main content

vv_agent/runtime/shell/
mod.rs

1mod command;
2mod metadata;
3mod path;
4mod platform;
5mod windows;
6
7pub use command::{build_shell_invocation, prepare_shell_execution};
8pub use metadata::normalize_windows_shell_priority;
9
10#[derive(Debug, Clone, PartialEq, Eq)]
11pub struct ShellInvocation {
12    pub kind: String,
13    pub name: String,
14    pub prefix: Vec<String>,
15}
16
17#[derive(Debug, Clone, PartialEq, Eq)]
18pub struct PreparedShellCommand {
19    pub kind: String,
20    pub command: Vec<String>,
21    pub shell: Option<String>,
22    pub stdin: Option<String>,
23}
24
25pub fn resolve_shell_invocation(
26    shell: Option<&str>,
27    windows_shell_priority: Option<&[String]>,
28) -> Result<ShellInvocation, String> {
29    if cfg!(target_os = "windows") {
30        return windows::resolve_windows_shell(shell, windows_shell_priority);
31    }
32    Ok(platform::resolve_posix_shell(shell))
33}