From b3381e6a8fcad8fc1e3ddd816eac127b0e254850 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Sun, 12 Aug 2012 16:44:34 -0700 Subject: [PATCH] os_posix: Print complete, attempted command line when execute() fails MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- common/os_posix.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 -- 2.43.0