* Restart process * * @param {String} cmd Application Name / Process id / JSON application file / 'all' * @param {Object} opts Extra options to be updated * @param {Function} cb Callback
(cmd, opts, cb)
| 485 | * @param {Function} cb Callback |
| 486 | */ |
| 487 | restart (cmd, opts, cb) { |
| 488 | if (typeof(opts) == "function") { |
| 489 | cb = opts; |
| 490 | opts = {}; |
| 491 | } |
| 492 | var that = this; |
| 493 | |
| 494 | if (typeof(cmd) === 'number') |
| 495 | cmd = cmd.toString(); |
| 496 | |
| 497 | if (cmd == "-") { |
| 498 | // Restart from PIPED JSON |
| 499 | process.stdin.resume(); |
| 500 | process.stdin.setEncoding('utf8'); |
| 501 | process.stdin.on('data', function (param) { |
| 502 | process.stdin.pause(); |
| 503 | that.actionFromJson('restartProcessId', param, opts, 'pipe', cb); |
| 504 | }); |
| 505 | } |
| 506 | else if (Common.isConfigFile(cmd) || typeof(cmd) === 'object') |
| 507 | that._startJson(cmd, opts, 'restartProcessId', cb); |
| 508 | else { |
| 509 | if (opts && opts.env) { |
| 510 | var err = 'Using --env [env] without passing the ecosystem.config.js does not work' |
| 511 | Common.err(err); |
| 512 | return cb ? cb(Common.retErr(err)) : that.exitCli(conf.ERROR_EXIT); |
| 513 | } |
| 514 | if (opts && !opts.updateEnv) |
| 515 | Common.printOut(IMMUTABLE_MSG); |
| 516 | that._operate('restartProcessId', cmd, opts, cb); |
| 517 | } |
| 518 | } |
| 519 | |
| 520 | /** |
| 521 | * Delete process |
no test coverage detected