diff --git a/codex-rs/shell-command/src/bash.rs b/codex-rs/shell-command/src/bash.rs index 770ff4795b..2a7478a5c1 100644 --- a/codex-rs/shell-command/src/bash.rs +++ b/codex-rs/shell-command/src/bash.rs @@ -128,6 +128,9 @@ pub fn parse_shell_lc_single_command_prefix(command: &[String]) -> Option) -> Option> { single_command } +fn has_named_descendant_kind(node: Node<'_>, kind: &str) -> bool { + let mut stack = vec![node]; + while let Some(current) = stack.pop() { + if current.kind() == kind { + return true; + } + let mut cursor = current.walk(); + for child in current.named_children(&mut cursor) { + stack.push(child); + } + } + false +} + fn parse_double_quoted_string(node: Node, src: &str) -> Option { if node.kind() != "string" { return None;