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

Method _callWithProcessId

modules/pm2-io-agent/src/PM2Interface.js:140–159  ·  view source on GitHub ↗
(fn, params, cb)

Source from the content-addressed store, hash-verified

138 }
139
140 _callWithProcessId (fn, params, cb) {
141 if (params.id === undefined) {
142 this.getProcessByName(params.name, (err, processes) => {
143 if (err) return cb(err)
144
145 // in case we don't find the process ourselves
146 // we believe pm2 will find it
147 if (processes.length === 0) {
148 return fn(Object.assign({ id: params.name }, params), cb)
149 }
150
151 async.eachOf(processes, (process, _key, localCb) => {
152 params.id = process.pm_id
153 fn(params, localCb)
154 }, cb)
155 })
156 } else {
157 fn(params, cb)
158 }
159 }
160
161 restart (params, cb) {
162 this._callWithProcessId(this.rpc.restartProcessId, params, cb)

Callers 5

restartMethod · 0.95
reloadMethod · 0.95
resetMethod · 0.95
pingMethod · 0.95

Calls 3

getProcessByNameMethod · 0.95
cbFunction · 0.85
fnFunction · 0.50

Tested by

no test coverage detected