Skip to content

Commit

Permalink
Use run_command within merge-index
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Shawn O. Pearce authored and Junio C Hamano committed Mar 13, 2007
1 parent 15a1c01 commit b49809c
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions merge-index.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "cache.h"
#include "run-command.h"

static const char *pgm;
static const char *arguments[8];
Expand All @@ -7,24 +8,10 @@ static int err;

static void run_program(void)
{
pid_t pid = fork();
int status;

if (pid < 0)
die("unable to fork");
if (!pid) {
execlp(pgm, arguments[0],
arguments[1],
arguments[2],
arguments[3],
arguments[4],
arguments[5],
arguments[6],
arguments[7],
NULL);
die("unable to execute '%s'", pgm);
}
if (waitpid(pid, &status, 0) < 0 || !WIFEXITED(status) || WEXITSTATUS(status)) {
struct child_process child;
memset(&child, 0, sizeof(child));
child.argv = arguments;
if (run_command(&child)) {
if (one_shot) {
err++;
} else {
Expand Down

0 comments on commit b49809c

Please sign in to comment.