MCPcopy
hub / github.com/thinkjs/thinkjs / run

Method run

lib/application.js:229–254  ·  view source on GitHub ↗

* run

()

Source from the content-addressed store, hash-verified

227 * run
228 */
229 run() {
230 if (pm2.isClusterMode) {
231 throw new Error('can not use pm2 cluster mode, please change exec_mode to fork');
232 }
233 // start file watcher
234 if (cluster.isMaster) this.startWatcher();
235
236 const instance = new ThinkLoader(this.options);
237 const argv = this.parseArgv();
238 try {
239 if (this._isRunInTest()) {
240 instance.loadAll('worker', true);
241 } else if (argv.path) {
242 instance.loadAll('worker', true);
243 return this.runInCli(argv);
244 } else if (cluster.isMaster) {
245 instance.loadAll('master');
246 return this.runInMaster(argv);
247 } else {
248 instance.loadAll('worker');
249 return this.runInWorker(argv);
250 }
251 } catch (e) {
252 console.error(e.stack);
253 }
254 }
255};
256
257/**

Callers 2

application.jsFile · 0.80
controller.jsFile · 0.80

Calls 8

startWatcherMethod · 0.95
parseArgvMethod · 0.95
_isRunInTestMethod · 0.95
runInCliMethod · 0.95
runInMasterMethod · 0.95
runInWorkerMethod · 0.95
loadAllMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected