Skip to content

Commit

Permalink
Merge pull request #3787 from Unitech/multi-only
Browse files Browse the repository at this point in the history
Multi only
  • Loading branch information
Unitech authored Jul 13, 2018
2 parents f70444f + bea9833 commit ea5d74a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
7 changes: 5 additions & 2 deletions lib/API.js
Original file line number Diff line number Diff line change
Expand Up @@ -887,8 +887,11 @@ class API {
if (!app.env) { app.env = {}; }
app.env.io = app.io;
// --only <app>
if (opts.only && opts.only != app.name)
return false;
if (opts.only) {
var apps = opts.only.split(/,| /)
if (apps.indexOf(app.name) == -1)
return false
}
// --watch
if (!app.watch && opts.watch && opts.watch === true)
app.watch = true;
Expand Down
2 changes: 1 addition & 1 deletion lib/binaries/Runtime4Docker.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ var Runtime = {
if (err)
return cb(err);
if (obj && obj.length == 0)
return cb(new Error('Failed to start application'))
return cb(new Error(`0 application started (no apps to run on ${cmd})`))

if (commander.web) {
var port = commander.web === true ? cst.WEB_PORT : commander.web;
Expand Down
5 changes: 5 additions & 0 deletions test/e2e/process-file/json-file.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,9 @@ should 'should start processes' 'online' 4
$pm2 reload all.json --only child
should 'should all script been restarted one time' 'restart_time: 2' 4

######## multu only

$pm2 start all.json --only "echo,child"
should 'should start processes' 'online' 5

$pm2 kill

0 comments on commit ea5d74a

Please sign in to comment.