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

Method connect

lib/API.js:163–189  ·  view source on GitHub ↗

* Connect to PM2 * Calling this command is now optional * * @param {Function} cb callback once pm2 is ready for commands

(noDaemon, cb)

Source from the content-addressed store, hash-verified

161 * @param {Function} cb callback once pm2 is ready for commands
162 */
163 connect (noDaemon, cb) {
164 var that = this;
165 this.start_timer = new Date();
166
167 if (typeof(cb) == 'undefined') {
168 cb = noDaemon;
169 noDaemon = false;
170 } else if (noDaemon === true) {
171 // Backward compatibility with PM2 1.x
172 this.Client.daemon_mode = false;
173 this.daemon_mode = false;
174 }
175
176 this.Client.start(function(err, meta) {
177 if (err)
178 return cb(err);
179
180 if (meta.new_pm2_instance == false && that.daemon_mode === true)
181 return cb(err, meta);
182
183 // If new pm2 instance has been popped
184 // Launch all modules
185 that.launchAll(that, function(err_mod) {
186 return cb(err, meta);
187 });
188 });
189 }
190
191 /**
192 * Usefull when custom PM2 created with independent flag set to true

Callers

nothing calls this directly

Calls 2

cbFunction · 0.85
startMethod · 0.45

Tested by

no test coverage detected