mirror of
https://github.com/openai/codex.git
synced 2026-11-21 22:50:37 +00:00
Restore Windows PowerShell parser API
This commit is contained in:
@@ -2,6 +2,8 @@ use std::path::PathBuf;
|
||||
|
||||
use codex_utils_absolute_path::AbsolutePathBuf;
|
||||
|
||||
#[cfg(windows)]
|
||||
use crate::command_safety::try_parse_powershell_ast_commands;
|
||||
use crate::shell_detect::ShellType;
|
||||
use crate::shell_detect::detect_shell_type;
|
||||
|
||||
@@ -69,6 +71,14 @@ pub fn extract_powershell_command(command: &[String]) -> Option<(&str, &str)> {
|
||||
None
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
pub fn parse_powershell_command_into_plain_commands(
|
||||
command: &[String],
|
||||
) -> Option<Vec<Vec<String>>> {
|
||||
let (executable, script) = extract_powershell_command(command)?;
|
||||
try_parse_powershell_ast_commands(executable, script)
|
||||
}
|
||||
|
||||
/// This function attempts to find a powershell.exe executable on the system.
|
||||
pub fn try_find_powershell_executable_blocking() -> Option<AbsolutePathBuf> {
|
||||
try_find_powershellish_executable_in_path(&["powershell.exe"])
|
||||
|
||||
Reference in New Issue
Block a user