From 57e6a49e5bbe1a6519d7507d7cd9b02e5ceca694 Mon Sep 17 00:00:00 2001
From: Eric Andersen <andersen@codepoet.org>
Date: Tue, 22 May 2001 22:34:51 +0000
Subject: [PATCH] Excellent.  This patch from Larry fixes the behavior of hush
 when builtins are included in pipes.

---
 hush.c       | 4 +++-
 shell/hush.c | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/hush.c b/hush.c
index f995f6f20..40787a464 100644
--- a/hush.c
+++ b/hush.c
@@ -1090,7 +1090,9 @@ static void pseudo_exec(struct child_prog *child)
 		for (x = bltins; x->cmd; x++) {
 			if (strcmp(child->argv[0], x->cmd) == 0 ) {
 				debug_printf("builtin exec %s\n", child->argv[0]);
-				_exit(x->function(child));
+				rcode = x->function(child);
+				fflush(stdout);
+				_exit(rcode);
 			}
 		}
 
diff --git a/shell/hush.c b/shell/hush.c
index f995f6f20..40787a464 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -1090,7 +1090,9 @@ static void pseudo_exec(struct child_prog *child)
 		for (x = bltins; x->cmd; x++) {
 			if (strcmp(child->argv[0], x->cmd) == 0 ) {
 				debug_printf("builtin exec %s\n", child->argv[0]);
-				_exit(x->function(child));
+				rcode = x->function(child);
+				fflush(stdout);
+				_exit(rcode);
 			}
 		}