From 4b76cb2100fdefecff79e2999b2a648eb149018b Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Tue, 18 Jan 2022 01:40:43 -0500 Subject: support redirects with subshells --- src/parse/ast.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/parse') diff --git a/src/parse/ast.rs b/src/parse/ast.rs index bd177a4..e2d5840 100644 --- a/src/parse/ast.rs +++ b/src/parse/ast.rs @@ -155,8 +155,10 @@ impl Exe { fn build_ast(pair: pest::iterators::Pair) -> Self { assert!(matches!(pair.as_rule(), Rule::subshell | Rule::exe)); if matches!(pair.as_rule(), Rule::subshell) { - let commands = pair.into_inner().next().unwrap(); + let mut iter = pair.into_inner(); + let commands = iter.next().unwrap(); assert!(matches!(commands.as_rule(), Rule::commands)); + let redirects = iter.map(Redirect::build_ast).collect(); return Self { exe: Word { parts: vec![WordPart::SingleQuoted( @@ -177,7 +179,7 @@ impl Exe { )], }, ], - redirects: vec![], + redirects, }; } let mut iter = pair.into_inner(); -- cgit v1.2.3-54-g00ecf