From 7dca5efaeeced2926536c6946b66745125b09a13 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Tue, 25 May 2021 10:11:11 -0400 Subject: [PATCH] Default tasks to running on creation, bump version, fix exit code --- libs/Task.js | 4 +++- libs/odmRunner.js | 4 +++- libs/taskNew.js | 2 -- package.json | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/libs/Task.js b/libs/Task.js index 08114a5..d9c6d51 100644 --- a/libs/Task.js +++ b/libs/Task.js @@ -46,7 +46,7 @@ module.exports = class Task{ this.dateCreated = isNaN(parseInt(dateCreated)) ? new Date().getTime() : parseInt(dateCreated); this.dateStarted = 0; this.processingTime = -1; - this.setStatus(statusCodes.QUEUED); + this.setStatus(statusCodes.RUNNING); this.options = options; this.gcpFiles = []; this.geoFiles = []; @@ -117,6 +117,8 @@ module.exports = class Task{ }); } ]), err => { + if (err) this.setStatus(statusCodes.FAILED, { errorMessage: err.message }); + else this.setStatus(statusCodes.QUEUED); this.initialized = true; done(err, this); }); diff --git a/libs/odmRunner.js b/libs/odmRunner.js index c49483e..bcf2cb7 100644 --- a/libs/odmRunner.js +++ b/libs/odmRunner.js @@ -71,7 +71,9 @@ module.exports = { } // Launch - let childProcess = spawn(command, params, {cwd: config.odm_path}); + const env = utils.clone(process.env); + env.ODM_NONINTERACTIVE = 1; + let childProcess = spawn(command, params, {cwd: config.odm_path, env}); childProcess .on('exit', (code, signal) => done(null, code, signal)) diff --git a/libs/taskNew.js b/libs/taskNew.js index 11d1d51..1c80ef0 100644 --- a/libs/taskNew.js +++ b/libs/taskNew.js @@ -406,8 +406,6 @@ module.exports = { task.initialize(err => { if (err) { - task.setStatus(statusCodes.FAILED, { errorMessage: err.message }); - // Cleanup removeDirectory(srcPath); removeDirectory(destPath); diff --git a/package.json b/package.json index 55980fe..a21ad31 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "NodeODM", - "version": "2.1.4", + "version": "2.1.5", "description": "REST API to access ODM", "main": "index.js", "scripts": {