aboutsummaryrefslogtreecommitdiffstats
path: root/lua/mason-core/installer
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2023-04-26 18:23:34 +0200
committerGitHub <noreply@github.com>2023-04-26 16:23:34 +0000
commite5bcda8ffb4668d484c1d08d6b5fbe12f330c727 (patch)
treec751bf492cb5205b1309c5f7d4c2d6c3963797fa /lua/mason-core/installer
parentfeat(linker): add ruby exec wrapper delegate (#1260) (diff)
downloadmason-e5bcda8ffb4668d484c1d08d6b5fbe12f330c727.tar
mason-e5bcda8ffb4668d484c1d08d6b5fbe12f330c727.tar.gz
mason-e5bcda8ffb4668d484c1d08d6b5fbe12f330c727.tar.bz2
mason-e5bcda8ffb4668d484c1d08d6b5fbe12f330c727.tar.lz
mason-e5bcda8ffb4668d484c1d08d6b5fbe12f330c727.tar.xz
mason-e5bcda8ffb4668d484c1d08d6b5fbe12f330c727.tar.zst
mason-e5bcda8ffb4668d484c1d08d6b5fbe12f330c727.zip
fix(context): don't write exec wrapper file if it already exists (#1261)
Diffstat (limited to 'lua/mason-core/installer')
-rw-r--r--lua/mason-core/installer/context.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/lua/mason-core/installer/context.lua b/lua/mason-core/installer/context.lua
index e42393ff..52fbcf16 100644
--- a/lua/mason-core/installer/context.lua
+++ b/lua/mason-core/installer/context.lua
@@ -342,6 +342,9 @@ local BATCH_TEMPLATE = _.dedent [[
---@param env table<string, string>?
---@return string # The created executable filename.
function InstallContext:write_shell_exec_wrapper(new_executable_rel_path, command, env)
+ if self.fs:file_exists(new_executable_rel_path) or self.fs:dir_exists(new_executable_rel_path) then
+ error(("Cannot write exec wrapper to %q because the file already exists."):format(new_executable_rel_path), 0)
+ end
return platform.when {
unix = function()
local std = require "mason-core.managers.std"