Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(gem): ensure bin path exist when linking #449

Merged
merged 1 commit into from
Sep 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lua/mason-core/managers/gem/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ local spawn = require "mason-core.spawn"
local Optional = require "mason-core.optional"
local installer = require "mason-core.installer"
local platform = require "mason-core.platform"
local fs = require "mason-core.fs"

local M = {}

Expand All @@ -27,6 +28,9 @@ end, _.if_else(_.always(platform.is.win), _.format "%s.bat", _.identity))
local function link_executable(executable)
local ctx = installer.context()
local bin_path = create_bin_path(executable)
if not ctx.fs:file_exists(bin_path) then
error(("Cannot link Gem executable %q because it doesn't exist in %q."):format(executable, bin_path), 0)
end
ctx:link_bin(
executable,
ctx:write_shell_exec_wrapper(executable, path.concat { ctx.package:get_install_path(), bin_path }, {
Expand Down