Excellent. This patch from Larry fixes the behavior of hush
authorEric Andersen <andersen@codepoet.org>
Tue, 22 May 2001 22:34:51 +0000 (22:34 -0000)
committerEric Andersen <andersen@codepoet.org>
Tue, 22 May 2001 22:34:51 +0000 (22:34 -0000)
when builtins are included in pipes.

hush.c
shell/hush.c

diff --git a/hush.c b/hush.c
index f995f6f20c07cbcacddee39bc6167ebd0a347be3..40787a4647011fae764bd19c812fc50f644f42ae 100644 (file)
--- 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);
                        }
                }
 
index f995f6f20c07cbcacddee39bc6167ebd0a347be3..40787a4647011fae764bd19c812fc50f644f42ae 100644 (file)
@@ -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);
                        }
                }