aboutsummaryrefslogtreecommitdiffstats
path: root/src/run/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/run/mod.rs')
-rw-r--r--src/run/mod.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/run/mod.rs b/src/run/mod.rs
index b45fac8..ba37061 100644
--- a/src/run/mod.rs
+++ b/src/run/mod.rs
@@ -183,13 +183,8 @@ impl<'a> Executor<'a> {
if let Some(cap) = capture {
if last_is_command {
- let child = children
- .into_iter()
- .last()
- .unwrap();
- let out = child
- .wait_with_output()
- .unwrap();
+ let child = children.into_iter().last().unwrap();
+ let out = child.wait_with_output().unwrap();
*cap = out.stdout;
} else {
*cap = last_output.into_inner();
@@ -218,6 +213,9 @@ impl<'a> parse::Expander for Executor<'a> {
fn expand_cmd(&mut self, ast: Ast<parse::PostExpansion>) -> Result<BString, Self::Error> {
let mut out = Vec::new();
self.execute(ast, Some(&mut out))?;
+ if out.last() == Some(&b'\n') {
+ out.pop();
+ }
Ok(out)
}
}