- wrapper: when run a job, write program name and cmdline to stderr

svn path=/trunk/boinc_samples/; revision=15240
This commit is contained in:
David Anderson 2008-05-16 22:12:05 +00:00
parent c4a02dc9c9
commit 5fbf895e3b
2 changed files with 13 additions and 5 deletions

View File

@ -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

View File

@ -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