From 7a16fe22c42c1558693d83260cce6081e706c552 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Fri, 5 Feb 2021 16:24:58 -0500 Subject: [PATCH] Save task output file --- libs/Task.js | 13 +++++++++++++ tests/processing_results/task_output.txt | 2 ++ 2 files changed, 15 insertions(+) create mode 100644 tests/processing_results/task_output.txt diff --git a/libs/Task.js b/libs/Task.js index a438854..9a13f41 100644 --- a/libs/Task.js +++ b/libs/Task.js @@ -376,6 +376,15 @@ module.exports = class Task{ }; }; + const saveTaskOutput = (destination) => { + return (done) => { + fs.writeFile(destination, this.output.join("\n"), err => { + if (err) logger.info(`Cannot write log at ${destination}, skipping...`); + done(); + }); + }; + } + // All paths are relative to the project directory (./data//) let allPaths = ['odm_orthophoto/odm_orthophoto.tif', 'odm_orthophoto/odm_orthophoto.png', @@ -384,6 +393,7 @@ module.exports = class Task{ 'odm_dem/dsm.tif', 'odm_dem/dtm.tif', 'dsm_tiles', 'dtm_tiles', 'orthophoto_tiles', 'potree_pointcloud', 'entwine_pointcloud', 'images.json', 'cameras.json', + 'task_output.txt', 'odm_report']; // Did the user request different outputs than the default? @@ -423,6 +433,9 @@ module.exports = class Task{ } if (!this.skipPostProcessing) tasks.push(runPostProcessingScript()); + + const taskOutputFile = path.join(this.getProjectFolderPath(), 'task_output.txt'); + tasks.push(saveTaskOutput(taskOutputFile)); const archiveFunc = config.has7z ? createZipArchive : createZipArchiveLegacy; tasks.push(archiveFunc('all.zip', allPaths)); diff --git a/tests/processing_results/task_output.txt b/tests/processing_results/task_output.txt new file mode 100644 index 0000000..baf9132 --- /dev/null +++ b/tests/processing_results/task_output.txt @@ -0,0 +1,2 @@ +test output +