Open robianmcd opened 10 years ago
Not sure how pm2 works. module.parent is supposed to check whether Strider is being require()'d as a module or not.
On Fri, Jun 27, 2014 at 12:55 PM, Rob notifications@github.com wrote:
I'm trying to start strider with pm2 but when I do, module.parent is set to an object so strider doesn't actually start. Any idea why this is? What does checking for module.parent actually do? Is that so you can require it in another script?
Thanks
— Reply to this email directly or view it on GitHub https://github.com/Strider-CD/strider/issues/449.
Niall O'Higgins W: http://niallohiggins.com E: n@niallo.me T: @niallohiggins
ok thanks. I'll ask over at pm2 and try and find out why module.parent isn't undefined
https://github.com/Unitech/pm2/issues/539 you could link the issue for others (:
Just went through the code and noticed: https://github.com/Strider-CD/strider/blob/master/bin/strider#L224 fs
is never defined ;)
@niallo what do you think about only checking for module.parent if no commands are passed in and allowing users to explicitly pass in a 'start' command? e.g.:
parser.command('start')
.option('extension_path', {
abbr: 'm'
, help: "Specify path to extensions (defaults to node_modules)"
})
.callback(function(opts){
start(opts.extension_path);
});
parser.nocommand()
.option('extension_path', {
abbr: 'm'
, help: "Specify path to extensions (defaults to node_modules)"
})
.callback(function(opts){
if (!module.parent) {
start(opts.extension_path);
}
});
parser.parse();
@soyuka thanks, fixed in #500
@niallo which option do you think we should go with? The on suggested at Unitech/pm2#539 or the one mentioned by @robianmcd?
I'm trying to start strider with pm2 but when I do,
module.parent
is set to an object so strider doesn't actually start. Any idea why this is? What does checking formodule.parent
actually do? Is that so you can require it in another script?Thanks