Skip to content

Commit b3f03e9

Browse files
committed
fix: guard exist? for non-absolute paths in npm packages
Match the cargo extension pattern: only check exist? for absolute paths so that test mocks with relative Pathname work correctly.
1 parent 461aa14 commit b3f03e9

File tree

1 file changed

+2
-1
lines changed
  • Library/Homebrew/bundle/extensions

1 file changed

+2
-1
lines changed

Library/Homebrew/bundle/extensions/npm.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ def packages
3232
packages = @packages
3333
return packages if packages
3434

35-
@packages = if (npm = package_manager_executable) && npm.exist?
35+
@packages = if (npm = package_manager_executable) &&
36+
(!npm.to_s.start_with?("/") || npm.exist?)
3637
parse_package_list(`#{npm} list -g --depth=0 --json 2>/dev/null`)
3738
end
3839
return [] if @packages.nil?

0 commit comments

Comments
 (0)