From 5fbf895e3b49da72aefa69e8d134bb00857e826f Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 16 May 2008 22:12:05 +0000 Subject: [PATCH] - wrapper: when run a job, write program name and cmdline to stderr svn path=/trunk/boinc_samples/; revision=15240 --- checkin_notes | 6 ++++++ wrapper/wrapper.C | 12 +++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/checkin_notes b/checkin_notes index becfd45c0b..3c7d410147 100644 --- a/checkin_notes +++ b/checkin_notes @@ -714,3 +714,9 @@ David 14 May 2008 example_app/ uc2.C + +David 16 May 2008 + - wrapper: when run a job, write program name and cmdline to stderr + + wrapper/ + wrapper.C diff --git a/wrapper/wrapper.C b/wrapper/wrapper.C index 06335ea6b7..4b4e911bfa 100644 --- a/wrapper/wrapper.C +++ b/wrapper/wrapper.C @@ -213,7 +213,11 @@ int TASK::run(int argct, char** argvt) { if ((i+1) < argct){ command_line += string(" "); } - } + } + + fprintf(stderr, "wrapper: running %s (%s)\n", + app_path.c_str(), command_line.c_str() + ); #ifdef _WIN32 PROCESS_INFORMATION process_info; @@ -241,7 +245,7 @@ int TASK::run(int argct, char** argvt) { } else { startup_info.hStdError = win_fopen(STDERR_FILE, "a"); } - + if (!CreateProcess( app_path.c_str(), (LPSTR)command.c_str(), @@ -303,7 +307,6 @@ int TASK::run(int argct, char** argvt) { argv[0] = buf; strlcpy(arglist, command_line.c_str(), sizeof(arglist)); argc = parse_command_line(arglist, argv+1); - fprintf(stderr, "wrapper: running %s (%s)\n", buf, arglist); setpriority(PRIO_PROCESS, 0, PROCESS_IDLE_PRIORITY); retval = execv(buf, argv); exit(ERR_EXEC); @@ -482,7 +485,6 @@ int main(int argc, char** argv) { TASK& task = tasks[i]; double frac_done = ((double)i)/((double)tasks.size()); - fprintf(stderr, "running %s\n", task.application.c_str()); task.starting_cpu = cpu; retval = task.run(argc, argv); if (retval) { @@ -522,7 +524,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR Args, int WinMode int argc; command_line = GetCommandLine(); - argc = parse_command_line( command_line, argv ); + argc = parse_command_line(command_line, argv); return main(argc, argv); } #endif