Skip to content

Commit

Permalink
fix: can not find iron-node in subprocess (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
popomore authored and fengmk2 committed Aug 18, 2016
1 parent 7db2c56 commit d6a57f5
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
20 changes: 20 additions & 0 deletions .autod.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'ues strict';

module.exports = {
write: true,
prefix: '^',
devprefix: '^',
exclude: [
'test/fixtures',
],
devdep: [
'autod',
],
keep: [
'istanbul',
'mocha',
'thunk-mocha',
],
semver: [
],
};
7 changes: 6 additions & 1 deletion lib/debug_command.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

const path = require('path');
const debug = require('debug')('egg-bin:debug');
const childprocess = require('childprocess');
const Command = require('./command');
Expand Down Expand Up @@ -39,17 +40,21 @@ class DebugCommand extends Command {
// this function will be toString() and save to tmp file
const cluster = require('cluster');
const originSetupMaster = cluster.setupMaster;
/* istanbul ignore next */
cluster.setupMaster = function(settings) {
if (!settings) return;
const args = settings.args || [];
args.unshift(settings.exec);
settings.args = args;
settings.exec = require.resolve('iron-node/bin/run.js');
settings.exec = process.env.IRON_NODE_PATH;
originSetupMaster.call(cluster, settings);
};
return [ modulePath, args, opt ];
});

// iron-node should be installed in cwd,
// resolve after iron-node installed
options.env.IRON_NODE_PATH = require.resolve(path.join(process.cwd(), 'node_modules/iron-node/bin/run.js'));
this.helper.forkNode(this.helper.serverBin, args, options);
}

Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"egg-bin": "bin/egg-bin.js"
},
"dependencies": {
"childprocess": "^2.0.0",
"childprocess": "^2.0.2",
"commander": "^2.9.0",
"common-bin": "^1.0.0",
"debug": "^2.2.0",
Expand All @@ -20,13 +20,13 @@
"thunk-mocha": "^1.0.3"
},
"devDependencies": {
"autod": "2",
"coffee": "3",
"autod": "^2.7.0",
"coffee": "^3.2.4",
"egg-ci": "1",
"eslint": "3",
"eslint-config-egg": "3",
"intelli-espower-loader": "^1.0.1",
"mm": "1",
"mm": "^2.0.0",
"power-assert": "^1.4.1"
},
"repository": {
Expand All @@ -40,7 +40,7 @@
"test": "TEST_TIMEOUT=3600000 TESTS=test/*.test.js bin/egg-bin.js test -r intelli-espower-loader",
"cov": "TEST_TIMEOUT=3600000 TESTS=test/*.test.js bin/egg-bin.js cov -r intelli-espower-loader",
"ci": "npm run lint && npm run cov",
"autod": "autod -e test/fixtures -f '^' -w"
"autod": "autod"
},
"engines": {
"node": ">= 4.0.0"
Expand Down

0 comments on commit d6a57f5

Please sign in to comment.