* 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)
| 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 |
no test coverage detected