-
-
Notifications
You must be signed in to change notification settings - Fork 201
Open
Description
Description
When using pcall to safely load a Lua module via require, the call unexpectedly returns true and a non-nil result (often true), even if the module does not exist in the filesystem. This behavior leads to false positives, making it appear as though the module was loaded successfully.
This issue seems to occur because pcall is returning true for the protected call, even when require fails to find the module. As a result, pcall is unable to reliably distinguish between a successfully loaded module and a missing or unavailable module, leading to subtle bugs when relying on pcall(require, ...) as a check for module existence.
To Reproduce
Steps to reproduce the behavior:
- type pcall(require("non-existing-package")) in the neovim command line you will get a response like ''true, true"
- Since 'strive' is not installed, the error ends up occurring.
Screencast.from.30-04-25.12.18.18.PM.IST.webm
Metadata
Metadata
Assignees
Labels
No labels
