~ chicken-core (chicken-5) e0bfebabd53694a2ce18157edda87bc9a013c4f3


commit e0bfebabd53694a2ce18157edda87bc9a013c4f3
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Mon Apr 3 21:50:18 2017 +0200
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Mon Apr 3 21:50:18 2017 +0200

    chicken-do: all wrong, of course

diff --git a/chicken-do.c b/chicken-do.c
index 0adf99a4..7c21b0a2 100644
--- a/chicken-do.c
+++ b/chicken-do.c
@@ -87,7 +87,7 @@ static int execute(char **argv)
     exit(1);
   }
 
-  exit(code);
+  return code;
 #else
   pid_t child = fork();
 
@@ -114,14 +114,9 @@ static int execute(char **argv)
       exit(1);
     }
 
-    if(WIFEXITED(status)) {
-      int s = WEXITSTATUS(status);
-
-      if(s != 0) cleanup();
+    if(WIFEXITED(status))
+      return WEXITSTATUS(status);
 
-      exit(s);
-    }
-    
     if(WIFSIGNALED(status)) {
       fprintf(stderr, "subprocess killed by signal %d\n", WTERMSIG(status));
       cleanup();
@@ -191,5 +186,9 @@ build:
     fflush(stdout);
   }
 
-  execute(args);
+  int s = execute(args);
+
+  if(s != 0) cleanup();
+
+  return s;
 }
Trap