Skip to content

Commit

Permalink
feature: #3757 --only='app1,app2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Unitech committed Jul 12, 2018
1 parent f807937 commit bea9833
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 bea9833

Please sign in to comment.