From fccf256427898e3e9d7de81ec8fdb66afe5523ef Mon Sep 17 00:00:00 2001
From: stratact <stratact1@gmail.com>
Date: Sat, 23 Mar 2019 05:42:54 +0000
Subject: [PATCH] Fix error for using statements in aliases

---
 src/lib/shell/flow.rs | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/lib/shell/flow.rs b/src/lib/shell/flow.rs
index 8efbb519..35eb6bb4 100644
--- a/src/lib/shell/flow.rs
+++ b/src/lib/shell/flow.rs
@@ -215,7 +215,9 @@ impl FlowLogic for Shell {
             }
             Statement::Pipeline(pipeline) => match expand_pipeline(&self, &pipeline) {
                 Ok((mut pipeline, statements)) => {
-                    self.run_pipeline(&mut pipeline);
+                    if !pipeline.items.is_empty() {
+                        self.run_pipeline(&mut pipeline);
+                    }
                     if self.flags & ERR_EXIT != 0 && self.previous_status != SUCCESS {
                         let status = self.previous_status;
                         self.exit(status);
@@ -512,14 +514,8 @@ fn expand_pipeline(
                     }
                 }
                 items.append(&mut pline.items);
-            } else {
-                return Err(format!(
-                    "unable to pipe inputs to alias: '{} = {}'",
-                    item.job.command.as_str(),
-                    alias.0.as_str()
-                ));
+                statements.remove(0);
             }
-            statements.remove(0);
 
             // Handle pipeline being broken half by i.e.: '&&' or '||'
             if !statements.is_empty() {
@@ -547,7 +543,7 @@ fn expand_pipeline(
                             true
                         }
                     }
-                    _ => true,
+                    _ => false,
                 };
                 if err {
                     return Err(format!(
-- 
GitLab