ref: 08c868015e1f07dba3ed4b0c960e48a4a69ee7c6
parent: 7f4ad68df834c5d81893b164acc97dd03441fc01
author: Roberto E. Vargas Caballero <[email protected]>
date: Thu Jun 2 07:33:57 EDT 2016
[driver] Move wait logic to build() We need this code in build because we have to wait for all the process before moving to compile the next source.
--- a/driver/posix/scc.c
+++ b/driver/posix/scc.c
@@ -189,6 +189,15 @@
spawn(settool(inittool(tool), out));
in = tool;
}
+ for (i = 0; i < NR_TOOLS; ++i) {
+ if ((pid = tools[i].pid) == 0)
+ continue;
+ if (waitpid(pid, &st, 0) < 0)
+ exit(-1);
+ tools[i].pid = 0;
+ if (!WIFEXITED(st) || WEXITSTATUS(st) != 0)
+ exit(-1);
+ }
}
static void
@@ -235,15 +244,6 @@
die("scc: fatal error: no input files");
build(*argv);
-
- for (i = 0; i < NR_TOOLS; ++i) {
- if ((pid = wait(&st)) < 0)
- break;
- if (pid == tools[i].pid)
- tools[i].pid = 0;
- if (!WIFEXITED(st) || WEXITSTATUS(st) != 0)
- exit(-1);
- }
return 0;
}