mirror of https://github.com/BOINC/boinc.git
parent
45b0426de5
commit
cc284ffd81
|
@ -684,15 +684,20 @@ int ACTIVE_TASK::abort() {
|
||||||
// check for the stderr file, copy to result record
|
// check for the stderr file, copy to result record
|
||||||
//
|
//
|
||||||
bool ACTIVE_TASK::read_stderr_file() {
|
bool ACTIVE_TASK::read_stderr_file() {
|
||||||
|
char stderr_file[MAX_BLOB_LEN];
|
||||||
char path[256];
|
char path[256];
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
sprintf(path, "%s%s%s", slot_dir, PATH_SEPARATOR, STDERR_FILE);
|
sprintf(path, "%s%s%s", slot_dir, PATH_SEPARATOR, STDERR_FILE);
|
||||||
FILE* f = fopen(path, "r");
|
FILE* f = fopen(path, "r");
|
||||||
if (f) {
|
if (f) {
|
||||||
n = fread(result->stderr_out, 1, sizeof(result->stderr_out), f);
|
n = fread(stderr_file, 1, sizeof(stderr_file), f);
|
||||||
result->stderr_out[n] = 0;
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
stderr_file[n-1] = '\0';
|
||||||
|
result->stderr_out += "<stderr_txt>\n";
|
||||||
|
result->stderr_out += stderr_file;
|
||||||
|
result->stderr_out += "\n</stderr_txt>\n";
|
||||||
|
result->stderr_out = result->stderr_out.substr(0,MAX_BLOB_LEN-1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1550,16 +1550,11 @@ int CLIENT_STATE::report_result_error(
|
||||||
res.exit_status,
|
res.exit_status,
|
||||||
res.signal
|
res.signal
|
||||||
);
|
);
|
||||||
|
res.stderr_out.append(buf);
|
||||||
if (strlen(res.stderr_out) + strlen(buf) < MAX_BLOB_LEN) {
|
|
||||||
strcat(res.stderr_out, buf );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((res.state == RESULT_FILES_DOWNLOADED) && err_num) {
|
if ((res.state == RESULT_FILES_DOWNLOADED) && err_num) {
|
||||||
sprintf(buf,"<couldnt_start>%d</couldnt_start>\n", err_num);
|
sprintf(buf,"<couldnt_start>%d</couldnt_start>\n", err_num);
|
||||||
if (strlen(res.stderr_out) + strlen(buf) < MAX_BLOB_LEN) {
|
res.stderr_out.append(buf);
|
||||||
strcat(res.stderr_out, buf );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res.state == RESULT_NEW) {
|
if (res.state == RESULT_NEW) {
|
||||||
|
@ -1572,9 +1567,7 @@ int CLIENT_STATE::report_result_error(
|
||||||
"</download_error>\n",
|
"</download_error>\n",
|
||||||
res.wup->input_files[i].file_info->name, failnum
|
res.wup->input_files[i].file_info->name, failnum
|
||||||
);
|
);
|
||||||
if (strlen(res.stderr_out) + strlen(buf) < MAX_BLOB_LEN ) {
|
res.stderr_out.append(buf);
|
||||||
strcat( res.stderr_out, buf );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1589,12 +1582,12 @@ int CLIENT_STATE::report_result_error(
|
||||||
"</upload_error>\n",
|
"</upload_error>\n",
|
||||||
res.output_files[i].file_info->name, failnum
|
res.output_files[i].file_info->name, failnum
|
||||||
);
|
);
|
||||||
if (strlen(res.stderr_out) + strlen(buf) < MAX_BLOB_LEN ) {
|
res.stderr_out.append(buf);
|
||||||
strcat( res.stderr_out, buf );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
res.stderr_out = res.stderr_out.substr(0,MAX_BLOB_LEN-1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -737,7 +737,7 @@ void RESULT::clear() {
|
||||||
exit_status = 0;
|
exit_status = 0;
|
||||||
active_task_state = 0;
|
active_task_state = 0;
|
||||||
signal = 0;
|
signal = 0;
|
||||||
strcpy(stderr_out, "");
|
stderr_out = "";
|
||||||
app = NULL;
|
app = NULL;
|
||||||
wup = NULL;
|
wup = NULL;
|
||||||
project = NULL;
|
project = NULL;
|
||||||
|
@ -790,7 +790,7 @@ int RESULT::parse_state(FILE* in) {
|
||||||
else if (match_tag(buf, "<stderr_out>")) {
|
else if (match_tag(buf, "<stderr_out>")) {
|
||||||
while (fgets(buf, 256, in)) {
|
while (fgets(buf, 256, in)) {
|
||||||
if (match_tag(buf, "</stderr_out>")) break;
|
if (match_tag(buf, "</stderr_out>")) break;
|
||||||
strcat(stderr_out, buf);
|
stderr_out.append(buf);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -813,17 +813,12 @@ int RESULT::write(FILE* out, bool to_server) {
|
||||||
final_cpu_time,
|
final_cpu_time,
|
||||||
state
|
state
|
||||||
);
|
);
|
||||||
n = strlen(stderr_out);
|
n = stderr_out.length();
|
||||||
if (n) {
|
if (n) {
|
||||||
fprintf(out,
|
fprintf(out, "<stderr_out>\n");
|
||||||
"<stderr_out>\n"
|
fprintf(out, stderr_out.c_str());
|
||||||
"%s",
|
|
||||||
stderr_out
|
|
||||||
);
|
|
||||||
if (stderr_out[n-1] != '\n') fprintf(out, "\n");
|
if (stderr_out[n-1] != '\n') fprintf(out, "\n");
|
||||||
fprintf(out,
|
fprintf(out, "</stderr_out>\n");
|
||||||
"</stderr_out>\n"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
if (!to_server) {
|
if (!to_server) {
|
||||||
if (server_ack) fprintf(out, " <server_ack/>\n");
|
if (server_ack) fprintf(out, " <server_ack/>\n");
|
||||||
|
|
|
@ -221,7 +221,7 @@ struct RESULT {
|
||||||
int signal; // the signal caught by the active_task,
|
int signal; // the signal caught by the active_task,
|
||||||
// defined only if active_task_state is PROCESS_SIGNALED
|
// defined only if active_task_state is PROCESS_SIGNALED
|
||||||
int active_task_state; // the state of the active task corresponding to this result
|
int active_task_state; // the state of the active task corresponding to this result
|
||||||
char stderr_out[MAX_BLOB_LEN];
|
string stderr_out;
|
||||||
|
|
||||||
APP* app;
|
APP* app;
|
||||||
WORKUNIT* wup;
|
WORKUNIT* wup;
|
||||||
|
|
Loading…
Reference in New Issue