spawnvppe_pipe(): Don't die on error, some callers want to handle it.

This commit is contained in:
Johannes Sixt
2007-01-25 14:56:02 +01:00
parent 93f6197dcc
commit 273855b70f
4 changed files with 11 additions and 4 deletions

View File

@@ -624,8 +624,11 @@ static void git_proxy_connect(int fd[2], char *host)
{
const char *argv[] = { NULL, host, port, NULL };
spawnvpe_pipe(git_proxy_command, argv, environ, pipefd[1], pipefd[0]);
pid = spawnvpe_pipe(git_proxy_command, argv, environ,
pipefd[1], pipefd[0]);
}
if (pid < 0)
die("fork failed");
fd[0] = pipefd[0][0];
fd[1] = pipefd[1][1];
}
@@ -761,6 +764,8 @@ pid_t git_connect(int fd[2], char *url, const char *prog)
env_unsetenv(env, INDEX_ENVIRONMENT);
pid = spawnvpe_pipe("sh", argv, env, pipefd[1], pipefd[0]);
}
if (pid < 0)
die("unable to fork");
fd[0] = pipefd[0][0];
fd[1] = pipefd[1][1];
if (free_path)

2
diff.c
View File

@@ -1500,6 +1500,8 @@ static int spawn_prog(const char *pgm, const char **arg)
fflush(NULL);
pid = spawnvpe_pipe(pgm, arg, environ, NULL, NULL);
if (pid < 0)
die("unable to fork");
while (waitpid(pid, &status, 0) < 0) {
if (errno == EINTR)

View File

@@ -11,6 +11,9 @@ static void run_program(void)
pid_t pid = spawnvpe_pipe(pgm, arguments, environ, NULL, NULL);
int status;
if (pid < 0)
die("unable to fork");
if (waitpid(pid, &status, 0) < 0 || !WIFEXITED(status) || WEXITSTATUS(status)) {
if (one_shot) {
err++;

View File

@@ -198,9 +198,6 @@ int spawnvppe_pipe(const char *cmd, const char **argv, const char **env,
pid = spawnvpe(_P_NOWAIT, interpr, qargv, env);
}
if (pid < 0)
die("unable to run %s", cmd);
free(qargv); /* TODO: quoted args should be freed, too */
free(prog);