Previously, only argv[0] was printed which did not provide much
information to the user about why the command might have
failed. Printing the entire command line allows the user to more
easily investigate the problem.
Signed-off-by: José Fonseca <jose.r.fonseca@gmail.com>
if (pid == 0) {
// child
execvp(args[0], args);
if (pid == 0) {
// child
execvp(args[0], args);
- fprintf(stderr, "error: failed to execute %s\n", args[0]);
+ fprintf(stderr, "error: failed to execute:");
+ for (unsigned i = 0; args[i]; ++i) {
+ fprintf(stderr, " %s", args[i]);
+ }
+ fprintf(stderr, "\n");
exit(-1);
} else {
// parent
exit(-1);
} else {
// parent