Skip to content

Commit

Permalink
fix: prevent postrun hook from running on uninstalled plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Oct 3, 2023
1 parent d44d87e commit a63f44b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,14 @@ export class Config implements IConfig {
await this.runHook('prerun', {Command: command, argv})

const result = (await command.run(argv, this)) as T

// If plugins:uninstall was run, we need to remove all the uninstalled plugins
// from this.plugins so that the postrun hook doesn't attempt to run any
// hooks that might have existed in the uninstalled plugins.
if (c.id === 'plugins:uninstall') {
for (const arg of argv) this.plugins.delete(arg)
}

await this.runHook('postrun', {Command: command, result, argv})

marker?.addDetails({command: id, plugin: c.pluginName!})
Expand Down

0 comments on commit a63f44b

Please sign in to comment.