From e5bcda8ffb4668d484c1d08d6b5fbe12f330c727 Mon Sep 17 00:00:00 2001 From: William Boman Date: Wed, 26 Apr 2023 18:23:34 +0200 Subject: fix(context): don't write exec wrapper file if it already exists (#1261) --- lua/mason-core/installer/context.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lua/mason-core/installer/context.lua') 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? ---@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" -- cgit v1.2.3-70-g09d2