@matheusbsbs / matheus-bagliano / commits / b49809c961
Fork 0

Use run_command within merge-index

Maybe unnecessary as the merge-index utility may go away in the future, but its currently here, its shorter to use run_command, and probably will help the MinGW port out. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>

Shawn O. Pearce committed Mar 12, 2007 at 19:00 UTC b49809c9615e7d2b854ce88b3dd0cd7790588fe5
1 file changed +5 -18
merge-index.c
+5 -18
@@ -1,4 +1,5 @@
1 #include "cache.h"
2 +#include "run-command.h"
3
4 static const char *pgm;
5 static const char *arguments[8];
@@ -7,24 +8,10 @@ static int err;
8
9 static void run_program(void)
10 {
10 - pid_t pid = fork();
11 - int status;
12 -
13 - if (pid < 0)
14 - die("unable to fork");
15 - if (!pid) {
16 - execlp(pgm, arguments[0],
17 - arguments[1],
18 - arguments[2],
19 - arguments[3],
20 - arguments[4],
21 - arguments[5],
22 - arguments[6],
23 - arguments[7],
24 - NULL);
25 - die("unable to execute '%s'", pgm);
26 - }
27 - if (waitpid(pid, &status, 0) < 0 || !WIFEXITED(status) || WEXITSTATUS(status)) {
11 + struct child_process child;
12 + memset(&child, 0, sizeof(child));
13 + child.argv = arguments;
14 + if (run_command(&child)) {
15 if (one_shot) {
16 err++;
17 } else {