MCPcopy
hub / github.com/serverless/serverless / run

Method run

packages/serverless/lib/classes/plugin-manager.js:976–1002  ·  view source on GitHub ↗

* Executes the provided commands array. This method initializes hooks, invokes * the commands, and handles any exceptions that occur during command execution. * If an exception occurs, it triggers the error hooks and rethrows the exception. * After successful execution or error handling, it

(commandsArray)

Source from the content-addressed store, hash-verified

974 * execution of error or finalize hooks.
975 */
976 async run(commandsArray) {
977 this.commandRunStartTime = Date.now()
978 if (this.serverless.processedInput.commands[0] !== 'plugin') {
979 // first initialize hooks
980 for (const { hook } of this.hooks.initialize || []) await hook()
981 }
982
983 try {
984 await this.invoke(commandsArray)
985 } catch (commandException) {
986 try {
987 for (const { hook } of this.hooks.error || [])
988 await hook(commandException)
989 } catch (errorHookException) {
990 const errorHookExceptionMeta = tokenizeException(errorHookException)
991 log.warning(
992 `The "error" hook crashed with:\n${
993 errorHookExceptionMeta.stack || errorHookExceptionMeta.message
994 }`,
995 )
996 } finally {
997 throw commandException // eslint-disable-line no-unsafe-finally
998 }
999 }
1000
1001 for (const { hook } of this.hooks.finalize || []) await hook()
1002 }
1003
1004 /**
1005 * Check if the command is valid. Internally this function will only find

Callers 15

agent.pyFile · 0.45
agent.pyFile · 0.45
agent.pyFile · 0.45
agent.pyFile · 0.45
agent.pyFile · 0.45
agent.pyFile · 0.45
agent.pyFile · 0.45
agent.pyFile · 0.45
agent.pyFile · 0.45
private_agent.pyFile · 0.45
public_agent.pyFile · 0.45
index.jsFile · 0.45

Calls 2

invokeMethod · 0.95
warningMethod · 0.80

Tested by

no test coverage detected