From bea983306c4736d3a2b1090f2708b7b29c44ed03 Mon Sep 17 00:00:00 2001 From: Unitech Date: Thu, 12 Jul 2018 15:19:03 +0200 Subject: [PATCH] feature: #3757 --only='app1,app2' --- lib/API.js | 7 +++++-- lib/binaries/Runtime4Docker.js | 2 +- test/e2e/process-file/json-file.sh | 5 +++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/API.js b/lib/API.js index 8f1a482aa..2fc78d008 100644 --- a/lib/API.js +++ b/lib/API.js @@ -887,8 +887,11 @@ class API { if (!app.env) { app.env = {}; } app.env.io = app.io; // --only - 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; diff --git a/lib/binaries/Runtime4Docker.js b/lib/binaries/Runtime4Docker.js index 837daa4b3..52df81174 100644 --- a/lib/binaries/Runtime4Docker.js +++ b/lib/binaries/Runtime4Docker.js @@ -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; diff --git a/test/e2e/process-file/json-file.sh b/test/e2e/process-file/json-file.sh index c6c984f5a..733c2b102 100644 --- a/test/e2e/process-file/json-file.sh +++ b/test/e2e/process-file/json-file.sh @@ -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