MCPcopy
hub / github.com/adonisjs/core / exec

Method exec

modules/ace/commands.ts:105–139  ·  view source on GitHub ↗

* Executes the lifecycle hooks and the run method from the command

()

Source from the content-addressed store, hash-verified

103 * Executes the lifecycle hooks and the run method from the command
104 */
105 async exec() {
106 this.hydrate()
107
108 try {
109 /**
110 * Executing the template methods
111 */
112 this.prepare && (await this.app.container.call<any, 'prepare'>(this, 'prepare'))
113 this.interact && (await this.app.container.call<any, 'interact'>(this, 'interact'))
114 const result = await this.app.container.call<BaseCommand, 'run'>(this, 'run')
115
116 /**
117 * Set exit code
118 */
119 this.result = this.result === undefined ? result : this.result
120 this.exitCode = this.exitCode ?? 0
121 } catch (error) {
122 this.error = error
123 this.exitCode = this.exitCode ?? 1
124 }
125
126 /**
127 * Run the completed method (if exists) and check if has handled
128 * the error
129 */
130 let errorHandled = this.completed
131 ? await this.app.container.call<any, 'completed'>(this, 'completed')
132 : false
133
134 if (this.error && !errorHandled) {
135 await this.kernel.errorHandler.render(this.error, this.kernel)
136 }
137
138 return this.result
139 }
140
141 /**
142 * Terminate the application gracefully. This method should be preferred over

Callers 15

createAceKernelFunction · 0.80
constructorMethod · 0.80
main.tsFile · 0.80
#configurePackageMethod · 0.80
runMethod · 0.80
make_test.spec.tsFile · 0.80
serve.spec.tsFile · 0.80

Implementers 1

ListCommandmodules/ace/commands.ts

Calls 1

renderMethod · 0.65

Tested by

no test coverage detected