From 7532af9053022bc60501276913d5aae4509a8c7f Mon Sep 17 00:00:00 2001 From: William Boman Date: Tue, 20 Sep 2022 17:25:18 +0200 Subject: [PATCH] feat(gem): ensure bin path exist when linking --- lua/mason-core/managers/gem/init.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lua/mason-core/managers/gem/init.lua b/lua/mason-core/managers/gem/init.lua index 0cbca3ae8..0f26fafb4 100644 --- a/lua/mason-core/managers/gem/init.lua +++ b/lua/mason-core/managers/gem/init.lua @@ -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 = {} @@ -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 }, {