windows error reporting fixes

svn path=/trunk/boinc/; revision=648
This commit is contained in:
Eric Heien 2002-11-22 00:13:47 +00:00
parent f5789f4104
commit a6d0366f59
3 changed files with 26 additions and 15 deletions

View File

@ -385,8 +385,6 @@ int ACTIVE_TASK_SET::insert(ACTIVE_TASK* atp) {
//
bool ACTIVE_TASK_SET::poll() {
ACTIVE_TASK* atp;
char path[256];
int n;
#ifdef _WIN32
unsigned long exit_code;
@ -417,11 +415,13 @@ bool ACTIVE_TASK_SET::poll() {
atp->result->exit_status = atp->exit_status;
CloseHandle(atp->pid_handle);
CloseHandle(atp->thread_handle);
atp->read_stderr_file();
clean_out_dir(atp->slot_dir);
}
}
}
return found;
return found;
#endif
#if HAVE_SYS_RESOURCE_H
@ -459,21 +459,29 @@ bool ACTIVE_TASK_SET::poll() {
#endif
#endif
// check for the stderr file, copy to result record
//
sprintf(path, "%s%s%s", atp->slot_dir, PATH_SEPARATOR, STDERR_FILE);
FILE* f = fopen(path, "r");
if (f) {
n = fread(atp->result->stderr_out, 1, STDERR_MAX_LEN, f);
atp->result->stderr_out[STDERR_MAX_LEN-1] = 0;
fclose(f);
}
atp->read_stderr_file();
clean_out_dir(atp->slot_dir);
return true;
}
// check for the stderr file, copy to result record
//
bool ACTIVE_TASK::read_stderr_file() {
char path[256];
int n;
sprintf(path, "%s%s%s", slot_dir, PATH_SEPARATOR, STDERR_FILE);
FILE* f = fopen(path, "r");
if (f) {
n = fread(result->stderr_out, 1, STDERR_MAX_LEN, f);
result->stderr_out[n] = 0;
fclose(f);
return true;
}
return false;
}
// Find the ACTIVE_TASK in the current set with the matching PID
//
ACTIVE_TASK* ACTIVE_TASK_SET::lookup_pid(int pid) {

View File

@ -76,6 +76,7 @@ public:
bool check_app_status_files();
double est_time_to_completion();
bool read_stderr_file();
int write(FILE*);
int parse(FILE*, CLIENT_STATE*);

View File

@ -739,7 +739,8 @@ bool CLIENT_STATE::garbage_collect() {
// any errors (MD5, RSA, etc)
fail_num = rp->wup->had_failure();
if (fail_num) {
rp->exit_status = fail_num;
if (!rp->exit_status) // If we don't already have an error for this file
rp->exit_status = fail_num;
if (rp->state < RESULT_READY_TO_ACK) {
rp->state = RESULT_READY_TO_ACK;
}
@ -754,7 +755,8 @@ bool CLIENT_STATE::garbage_collect() {
//
fail_num = rp->output_files[i].file_info->had_failure();
if (fail_num) {
rp->exit_status = fail_num;
if (!rp->exit_status) // If we don't already have an error for this file
rp->exit_status = fail_num;
if (rp->state < RESULT_READY_TO_ACK) {
rp->state = RESULT_READY_TO_ACK;
}