From 7078c411a209770aab5ac2a64575d87891811cda Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 18 Feb 2010 19:37:25 +0000 Subject: [PATCH] - wrapper: print more detailed msgs if process creation fails svn path=/trunk/boinc/; revision=20631 --- checkin_notes | 6 ++++++ samples/wrapper/wrapper.cpp | 8 ++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/checkin_notes b/checkin_notes index 914ae46c55..4458b0e0cb 100644 --- a/checkin_notes +++ b/checkin_notes @@ -1267,3 +1267,9 @@ David 18 Feb 2010 client/ work_fetch.cpp + +David 18 Feb 2010 + - wrapper: print more detailed msgs if process creation fails + + samples/wrapper/ + wrapper.cpp diff --git a/samples/wrapper/wrapper.cpp b/samples/wrapper/wrapper.cpp index a27bac9c3b..19fb9db8b8 100644 --- a/samples/wrapper/wrapper.cpp +++ b/samples/wrapper/wrapper.cpp @@ -326,6 +326,9 @@ int TASK::run(int argct, char** argvt) { &startup_info, &process_info )) { + char error_msg[1024]; + windows_error_string(error_msg, sizeof(error_msg)); + fprintf(stderr, "can't run app: %s\n", error_msg); return ERR_EXEC; } pid_handle = process_info.hProcess; @@ -343,7 +346,8 @@ int TASK::run(int argct, char** argvt) { pid = fork(); if (pid == -1) { - boinc_finish(ERR_FORK); + perror("fork(): "); + return ERR_FORK; } if (pid == 0) { // we're in the child process here @@ -376,6 +380,7 @@ int TASK::run(int argct, char** argvt) { argc = parse_command_line(arglist, argv+1); setpriority(PRIO_PROCESS, 0, PROCESS_IDLE_PRIORITY); retval = execv(app_path, argv); + perror("execv() failed: "); exit(ERR_EXEC); } #endif @@ -567,7 +572,6 @@ int main(int argc, char** argv) { task.starting_cpu = checkpoint_cpu_time; retval = task.run(argc, argv); if (retval) { - fprintf(stderr, "can't run app: %d\n", retval); boinc_finish(retval); } while (1) {