]> git.cworth.org Git - apitrace/commitdiff
os_posix: Print complete, attempted command line when execute() fails
authorCarl Worth <cworth@cworth.org>
Sun, 12 Aug 2012 23:44:34 +0000 (16:44 -0700)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Mon, 8 Oct 2012 18:02:21 +0000 (19:02 +0100)
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>
common/os_posix.cpp

index 7d39d8ada5e0ffafc0f730bcdd3e913744f734d2..0d93b31bcafa6e56604fa639a7656d20128835ca 100644 (file)
@@ -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