From: Carl Worth Date: Sun, 12 Aug 2012 23:44:34 +0000 (-0700) Subject: os_posix: Print complete, attempted command line when execute() fails X-Git-Url: https://git.cworth.org/git?p=apitrace;a=commitdiff_plain;h=b3381e6a8fcad8fc1e3ddd816eac127b0e254850 os_posix: Print complete, attempted command line when execute() fails 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 --- diff --git a/common/os_posix.cpp b/common/os_posix.cpp index 7d39d8a..0d93b31 100644 --- a/common/os_posix.cpp +++ b/common/os_posix.cpp @@ -134,7 +134,11 @@ int execute(char * const * 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