Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Unitech committed Jan 12, 2015
1 parent 4510fb5 commit d61d710
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
3 changes: 2 additions & 1 deletion examples/args.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ process.argv.forEach(function (val, index, array) {
console.log(index + ': ' + val);
});

console.log('Argv2 = ', process.argv[2]);

setInterval(function() {
console.log('HERE ARE MY ARGS !!! = ', process.argv);
}, 800);

7 changes: 7 additions & 0 deletions examples/axm/probes.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,14 @@ setInterval(function() {
}, 1500);


axm.catchAll();

axm.action('throw error', function(reply) {
setTimeout(function() {
console.log('log message from echo auto kill');
throw new Error('Exitasdsadasdsda unacepted 222222 !!');
}, 2000);
});


axm.action('dec', function(reply) {
Expand Down
11 changes: 11 additions & 0 deletions examples/start-args.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@


var pm2 = require('..');

pm2.connect(function() {
pm2.start(__dirname + '/args.js', {
scriptArgs : ['-i', 'sisi', '-x', 'toto']
}, function(err, res) {
console.log(arguments);
});
});
4 changes: 4 additions & 0 deletions lib/CLI.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,13 @@ CLI.start = function(script, opts, cb) {
delete conf.args;

var argsIndex;

if (opts.rawArgs && (argsIndex = opts.rawArgs.indexOf('--')) >= 0) {
conf.args = opts.rawArgs.slice(argsIndex + 1);
}
else if (opts.scriptArgs) {
conf.args = opts.scriptArgs;
}

conf.script = script;

Expand Down

0 comments on commit d61d710

Please sign in to comment.