[hackers] [scc] [driver] Move wait logic to build() || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Thu, 2 Jun 2016 11:35:33 +0200 (CEST)

commit 63d94614fadf26fe058afb1afa9c9b7686efac8f
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Thu Jun 2 11:33:57 2016 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Thu Jun 2 11:33:57 2016 +0200

    [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.

diff --git a/driver/posix/scc.c b/driver/posix/scc.c
index ca8e69c..5c04947 100644
--- a/driver/posix/scc.c
+++ b/driver/posix/scc.c
_AT_@ -189,6 +189,15 @@ build(char *file)
                 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
_AT_@ -236,14 +245,5 @@ main(int argc, char *argv[])
 
         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;
 }
Received on Thu Jun 02 2016 - 11:35:33 CEST

This archive was generated by hypermail 2.3.0 : Thu Jun 02 2016 - 11:36:14 CEST