handle split and intr transfers properly
[AROS.git] / tools / collect-aros / docommand-exec.c
blob763665b73bbb1d2b4bfd7d4ba73c5dd8323ad0b7
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <unistd.h>
7 #include <stdlib.h>
8 #include <string.h>
9 #include <errno.h>
10 #include <sys/wait.h>
11 #include <fcntl.h>
12 #include <sys/param.h>
14 #include "docommand.h"
15 #include "misc.h"
17 static void _docommandv(const char *command, char *argv[], int do_path)
19 pid_t pid = vfork();
20 int status;
22 if (pid == -1)
23 fatal("vfork()", strerror(errno));
25 if (pid == 0)
27 (do_path ? execvp : execv)(command, argv);
29 nonfatal(command, strerror(errno));
31 _exit(EXIT_FAILURE);
34 waitpid(pid, &status, 0);
35 if (WEXITSTATUS(status) != 0)
36 exit(EXIT_FAILURE);
39 void docommandv(const char *command, char *argv[])
41 _docommandv(command, argv, 0);
44 void docommandvp(const char *command, char *argv[])
46 set_compiler_path();
47 _docommandv(command, argv, 1);