return the command's exit code.

SVN revision: 73366
This commit is contained in:
Gustavo Sverzut Barbieri 2012-07-05 15:06:06 +00:00
parent cfaf0c12b5
commit 556804a721
1 changed files with 10 additions and 3 deletions

View File

@ -483,14 +483,21 @@ main(int argc, char *argv[])
else
{
char **itr;
int ret = EXIT_SUCCESS;
for (itr = cmds; *itr != NULL; itr++)
{
system(*itr);
/* Question: should we execute them in parallel? */
int r = system(*itr);
if (r < 0)
fprintf(stderr, "ERROR: %s executing %s\n", strerror(errno),
*itr);
free(*itr);
if (r > 0) /* Question: should we stop the loop on first faiure? */
ret = r;
}
free(cmds);
}
return EXIT_SUCCESS;
return ret;
}
}