Skip to content
Snippets Groups Projects
Commit 69099b13 authored by Sean McArthur's avatar Sean McArthur
Browse files

fixes to get it running on Windows

- Windows doesn't have signals, so process.on("SIGINT") throws
- changing process.env.PATH is a bad idea
parent 120dd496
No related branches found
No related tags found
No related merge requests found
......@@ -75,5 +75,9 @@ exports.handleTerminationSignals = function(app, callback) {
};
}
process.on('SIGINT', endIt('INT')).on('SIGTERM', endIt('TERM')).on('SIGQUIT', endIt('QUIT'));
try {
process.on('SIGINT', endIt('INT')).on('SIGTERM', endIt('TERM')).on('SIGQUIT', endIt('QUIT'));
} catch (noSignals) {
// Window doesn't support signals
}
};
......@@ -43,7 +43,7 @@
"scripts": {
"postinstall": "./scripts/generate_ephemeral_keys.sh",
"test": "./scripts/test",
"start": "./scripts/run_locally.js"
"start": "node ./scripts/run_locally.js"
},
"engines": {
"node": ">= 0.6.2"
......
......@@ -80,6 +80,7 @@ if (config.get('env').substr(0,5) === 'test_') {
function runDaemon(daemon, cb) {
Object.keys(daemonsToRun[daemon]).forEach(function(ek) {
if (ek === 'path') return; // this blows away the Window PATH
process.env[ek] = daemonsToRun[daemon][ek];
});
var pathToScript = daemonsToRun[daemon].path || path.join(__dirname, "..", "bin", daemon);
......@@ -104,6 +105,7 @@ function runDaemon(daemon, cb) {
console.log("spawned", daemon, "("+pathToScript+") with pid", p.pid);
Object.keys(daemonsToRun[daemon]).forEach(function(ek) {
if (ek === 'path') return; // don't kill the Windows PATH
delete process.env[ek];
});
......@@ -133,7 +135,11 @@ daemonNames.forEach(function(dn) {
});
});
process.on('SIGINT', function () {
console.log('\nSIGINT recieved! trying to shut down gracefully...');
Object.keys(daemons).forEach(function (k) { daemons[k].kill('SIGINT'); });
});
try {
process.on('SIGINT', function () {
console.log('\nSIGINT recieved! trying to shut down gracefully...');
Object.keys(daemons).forEach(function (k) { daemons[k].kill('SIGINT'); });
});
} catch (noSignals) {
// Windows doesn't have signal support, so node explodes
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment