aboutsummaryrefslogtreecommitdiff
path: root/smash
diff options
context:
space:
mode:
Diffstat (limited to 'smash')
-rw-r--r--smash/exec.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/smash/exec.c b/smash/exec.c
index 0fca393..b37576a 100644
--- a/smash/exec.c
+++ b/smash/exec.c
@@ -11,6 +11,7 @@
#include "../lib/io/io.h"
#include "../lib/env/env.h"
#include "../lib/malloc/malloc.h"
+#include "../lib/list/list.h"
#include "parser.h"
#include "builtin.h"
@@ -61,6 +62,7 @@ void exec(char *line)
{
expression_list_t *exps = new_expression_from_line(line);
expression_list_t *exp = exps;
+ list_t *pids = new_list();
int pid;
int pipefd[2][2];
@@ -106,10 +108,16 @@ void exec(char *line)
free_argv(argv);
- wait4(pid, 0, 0);
+ list_append(pids, pid);
exp = exp->next;
}
+ list_node_t *node = pids->first;
+
+ for (; node; node = node->next) {
+ wait4((int)node->value, 0, 0);
+ }
+
free_expression(exps);
}