oclif / core

Node.js Open CLI Framework. Built by Salesforce.

Home Page:https://oclif.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`postrun` hooks of uninstalled plugins are executed

mdonnalley opened this issue · comments

Describe the bug

When uninstalling a plugin that has a postrun hook, @oclif/core still attempts to run the hook even though that code path no longer exists.

~ » sf plugins uninstall sfdx-hardis                                                                                                                                                                                                                
Uninstalling sfdx-hardis... ⢿ [2/2] Regenerating lockfile and installing missing dependencies...
Uninstalling sfdx-hardis... done
 ›   ModuleLoadError: [MODULE_NOT_FOUND] require failed to load /Users/mdonnalley/.local/share/sf/node_modules/sfdx-hardis/lib/hooks/postrun/notify: Cannot find module '/Users/mdonnalley/.local/share/sf/node_modules/sfdx-hardis/lib/hooks/postrun/notify'
 ›   Require stack:
 ›   - /Users/mdonnalley/.local/share/sf/client/2.10.2-1c35561/node_modules/@oclif/core/lib/module-loader.js
 ›   - /Users/mdonnalley/.local/share/sf/client/2.10.2-1c35561/node_modules/@oclif/core/lib/help/util.js
 ›   - /Users/mdonnalley/.local/share/sf/client/2.10.2-1c35561/node_modules/@oclif/core/lib/help/formatter.js
 ›   - /Users/mdonnalley/.local/share/sf/client/2.10.2-1c35561/node_modules/@oclif/core/lib/help/command.js
 ›   - /Users/mdonnalley/.local/share/sf/client/2.10.2-1c35561/node_modules/@oclif/core/lib/help/index.js
 ›   - /Users/mdonnalley/.local/share/sf/client/2.10.2-1c35561/node_modules/@oclif/core/lib/flags.js
 ›   - /Users/mdonnalley/.local/share/sf/client/2.10.2-1c35561/node_modules/@oclif/core/lib/cli-ux/styled/table.js
 ›   - /Users/mdonnalley/.local/share/sf/client/2.10.2-1c35561/node_modules/@oclif/core/lib/cli-ux/styled/index.js
 ›   - /Users/mdonnalley/.local/share/sf/client/2.10.2-1c35561/node_modules/@oclif/core/lib/cli-ux/index.js
 ›   - /Users/mdonnalley/.local/share/sf/client/2.10.2-1c35561/node_modules/@oclif/core/lib/command.js
 ›   - /Users/mdonnalley/.local/share/sf/client/2.10.2-1c35561/node_modules/@oclif/core/lib/index.js
 ›   - /Users/mdonnalley/.local/share/sf/client/2.10.2-1c35561/dist/cli.js
 ›   - /Users/mdonnalley/.local/share/sf/client/2.10.2-1c35561/bin/run
 ›   Code: MODULE_NOT_FOUND

To Reproduce

  1. sf plugins install sfdx-hardis
  2. sf plugins uninstall sfdx-hardis

Expected behavior
The postrun hook of the uninstalled plugin should not be run.

This issue has been linked to a new work item: W-14226831