diff --git a/checkin_notes b/checkin_notes
index 1c585c8ec9..cffa2cbe9e 100755
--- a/checkin_notes
+++ b/checkin_notes
@@ -5969,3 +5969,14 @@ Rom 14 June 2006
lib/
diagnostics.C
+
+David 14 June 2006
+ - core client: implement property for output files
+ (previously it was implemented for input files only).
+ If present, move the file from slot directory
+ to project directory when the result is done.
+
+ client/
+ app.h
+ app_control.C
+ app_start.C
diff --git a/client/app.h b/client/app.h
index a046b2dedf..6ad763592a 100644
--- a/client/app.h
+++ b/client/app.h
@@ -199,6 +199,7 @@ public:
int move_trickle_file();
int handle_upload_files();
void upload_notify_app(const FILE_INFO*, const FILE_REF*);
+ int copy_output_files();
int write(MIOFILE&);
int parse(MIOFILE&);
diff --git a/client/app_control.C b/client/app_control.C
index cb23b69710..7a122b60c6 100644
--- a/client/app_control.C
+++ b/client/app_control.C
@@ -178,12 +178,17 @@ static void limbo_message(ACTIVE_TASK& at) {
//
#ifdef _WIN32
void ACTIVE_TASK::handle_exited_app(unsigned long exit_code) {
+#else
+void ACTIVE_TASK::handle_exited_app(int stat) {
+#endif
+ SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_TASK);
get_app_status_msg();
get_trickle_up_msg();
result->final_cpu_time = current_cpu_time;
if (task_state == PROCESS_ABORT_PENDING) {
task_state = PROCESS_ABORTED;
} else {
+#ifdef _WIN32
task_state = PROCESS_EXITED;
if (exit_code) {
@@ -210,28 +215,7 @@ void ACTIVE_TASK::handle_exited_app(unsigned long exit_code) {
}
}
result->exit_status = exit_code;
- }
-
- if (app_client_shm.shm) {
- detach_shmem(shm_handle, app_client_shm.shm);
- app_client_shm.shm = NULL;
- }
-
- read_stderr_file();
- clean_out_dir(slot_dir);
-done:
- gstate.request_schedule_cpus("application exited");
-}
#else
-void ACTIVE_TASK::handle_exited_app(int stat) {
- SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_TASK);
-
- get_app_status_msg();
- get_trickle_up_msg();
- result->final_cpu_time = current_cpu_time;
- if (task_state == PROCESS_ABORT_PENDING) {
- task_state = PROCESS_ABORTED;
- } else {
if (WIFEXITED(stat)) {
task_state = PROCESS_EXITED;
result->exit_status = WEXITSTATUS(stat);
@@ -304,14 +288,24 @@ void ACTIVE_TASK::handle_exited_app(int stat) {
task_state = PROCESS_EXIT_UNKNOWN;
result->state = PROCESS_EXIT_UNKNOWN;
}
+#endif
}
+#ifdef _WIN32
+ if (app_client_shm.shm) {
+ detach_shmem(shm_handle, app_client_shm.shm);
+ app_client_shm.shm = NULL;
+ }
+#endif
+
+ // here when task is finished for good
+ //
+ copy_output_files();
read_stderr_file();
clean_out_dir(slot_dir);
done:
gstate.request_schedule_cpus("application exited");
}
-#endif
bool ACTIVE_TASK::finish_file_present() {
char path[256];
diff --git a/client/app_start.C b/client/app_start.C
index 16dedfdc94..b3acd22a09 100644
--- a/client/app_start.C
+++ b/client/app_start.C
@@ -272,6 +272,25 @@ static int setup_file(
return 0;
}
+int ACTIVE_TASK::copy_output_files() {
+ char slotfile[256], projfile[256];
+ unsigned int i;
+ for (i=0; ioutput_files.size(); i++) {
+ FILE_REF& fref = result->output_files[i];
+ if (!fref.copy_file) continue;
+ FILE_INFO* fip = fref.file_info;
+ sprintf(slotfile, "%s/%s", slot_dir, fref.open_name);
+ get_pathname(fip, projfile);
+ int retval = boinc_rename(slotfile, projfile);
+ if (retval) {
+ msg_printf(wup->project, MSG_ERROR,
+ "Can't rename output file %s", fip->name
+ );
+ }
+ }
+ return 0;
+}
+
// Start a task in a slot directory.
// This includes setting up soft links,
// passing preferences, and starting the process
@@ -363,6 +382,7 @@ int ACTIVE_TASK::start(bool first_time) {
}
for (i=0; ioutput_files.size(); i++) {
fref = result->output_files[i];
+ if (fref.copy_file) continue;
fip = fref.file_info;
get_pathname(fref.file_info, file_path);
retval = setup_file(wup, fip, fref, file_path, slot_dir);