clone, keep process env vars

pull/91/head
Piero Toffanin 2019-07-15 15:02:59 -04:00
rodzic 27ed79a5a3
commit 2f54e12470
3 zmienionych plików z 8 dodań i 6 usunięć

Wyświetl plik

@ -22,6 +22,7 @@ let assert = require('assert');
let spawn = require('child_process').spawn;
let config = require('../config.js');
let logger = require('./logger');
let utils = require('./utils');
function makeRunner(command, args, requiredOptions = [], outputTestFile = null){
@ -58,11 +59,9 @@ function makeRunner(command, args, requiredOptions = [], outputTestFile = null){
}
// Launch
let childProcess = spawn(command, commandArgs, {
env:{
LD_LIBRARY_PATH: path.join(config.odm_path, "SuperBuild", "install", "lib")
}
});
const env = utils.clone(process.env);
env.LD_LIBRARY_PATH = path.join(config.odm_path, "SuperBuild", "install", "lib");
let childProcess = spawn(command, commandArgs, { env });
childProcess
.on('exit', (code, signal) => done(null, code, signal))

Wyświetl plik

@ -44,5 +44,9 @@ module.exports = {
const safeSuffix = path.normalize(p).replace(/^(\.\.(\/|\\|$))+/, '');
return path.join('./', safeSuffix);
});
},
clone: function(json){
return JSON.parse(JSON.stringify(json));
}
};

Wyświetl plik

@ -7,7 +7,6 @@ PIDFile=/run/nodeodm.pid
User=odm
Group=odm
WorkingDirectory=/www
Environment="HOME=/www/data"
ExecStart=/usr/bin/node index.js
ExecStop=/bin/kill -s QUIT $MAINPID
Restart=on-failure