MCPcopy
hub / github.com/Unitech/pm2 / start

Method start

lib/API.js:316–337  ·  view source on GitHub ↗

* Start a file or json with configuration * @param {Object||String} cmd script to start or json * @param {Function} cb called when application has been started

(cmd, opts, cb)

Source from the content-addressed store, hash-verified

314 * @param {Function} cb called when application has been started
315 */
316 start (cmd, opts, cb) {
317 if (typeof(opts) == "function") {
318 cb = opts;
319 opts = {};
320 }
321 if (!opts) opts = {};
322
323 var that = this;
324 if (Array.isArray(opts.watch) && opts.watch.length === 0)
325 opts.watch = (opts.rawArgs ? !!~opts.rawArgs.indexOf('--watch') : !!~process.argv.indexOf('--watch')) || false;
326
327 if (Common.isConfigFile(cmd) || (typeof(cmd) === 'object')) {
328 that._startJson(cmd, opts, 'restartProcessId', (err, procs) => {
329 return cb ? cb(err, procs) : this.speedList()
330 })
331 }
332 else {
333 that._startScript(cmd, opts, (err, procs) => {
334 return cb ? cb(err, procs) : this.speedList(0)
335 })
336 }
337 }
338
339 /**
340 * Reset process counters

Callers 15

Client.jsFile · 0.45
God.jsFile · 0.45
Daemon.jsFile · 0.45
connectMethod · 0.45
Extra.jsFile · 0.45
launchNPMModulesFunction · 0.45
launchTARModulesFunction · 0.45
StartModuleFunction · 0.45
runInstallFunction · 0.45
startFunction · 0.45
runFunction · 0.45
execFunction · 0.45

Calls 5

speedListMethod · 0.95
cbFunction · 0.85
indexOfMethod · 0.80
_startJsonMethod · 0.80
_startScriptMethod · 0.80

Tested by

no test coverage detected