lib/models/revision.js: make independent of exec-path

Previously calling `app.js` from another directory than
the base directory of CodiMD would result in an error being
thrown because `lib/workers/dmpWorker.js` could not be found.

This change makes the function call independent of the path CodiMD
is started from.

Signed-off-by: WilliButz <wbutz@cyberfnord.de>
This commit is contained in:
WilliButz 2018-09-05 19:49:01 +02:00
parent eb885af995
commit bd2f7cef49
No known key found for this signature in database
GPG Key ID: 92582A10F1179CB2
1 changed files with 2 additions and 1 deletions

View File

@ -5,6 +5,7 @@ var async = require('async')
var moment = require('moment') var moment = require('moment')
var childProcess = require('child_process') var childProcess = require('child_process')
var shortId = require('shortid') var shortId = require('shortid')
var path = require('path')
// core // core
var config = require('../config') var config = require('../config')
@ -14,7 +15,7 @@ var dmpWorker = createDmpWorker()
var dmpCallbackCache = {} var dmpCallbackCache = {}
function createDmpWorker () { function createDmpWorker () {
var worker = childProcess.fork('./lib/workers/dmpWorker.js', { var worker = childProcess.fork(path.resolve(__dirname, '../workers/dmpWorker.js'), {
stdio: 'ignore' stdio: 'ignore'
}) })
if (config.debug) logger.info('dmp worker process started') if (config.debug) logger.info('dmp worker process started')