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?a=commitdiff_plain;h=b3381e6a8fcad8fc1e3ddd816eac127b0e254850;hp=f45f1e2f0113a78a64b909ad87801f9f63a1fd28;p=apitrace 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