From ef37c13442417d26e685f15b5554e9d55db2cd70 Mon Sep 17 00:00:00 2001 From: William Boman Date: Tue, 20 Sep 2022 17:26:09 +0200 Subject: feat(gem): ensure bin path exist when linking (#449) --- lua/mason-core/managers/gem/init.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lua') diff --git a/lua/mason-core/managers/gem/init.lua b/lua/mason-core/managers/gem/init.lua index 0cbca3ae..0f26fafb 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 }, { -- cgit v1.2.3-70-g09d2