Skip to content

Commit 2969b80

Browse files
DenzellceWolf
authored andcommitted
fix(init): only run debug when build succeeded
1 parent cef8915 commit 2969b80

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

lua/cmake-tools/init.lua

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1890,7 +1890,10 @@ function cmake.register_dap_function()
18901890

18911891
if opt.target then
18921892
-- explicit target requested. use that instead of the configured one
1893-
return cmake.build({ target = opt.target }, function()
1893+
return cmake.build({ target = opt.target }, function(build_result)
1894+
if not build_result:is_ok() then
1895+
return
1896+
end
18941897
local model = config:get_code_model_info()[opt.target]
18951898
local result = config:get_launch_target_from_info(model)
18961899
local dap_config = {
@@ -1932,7 +1935,10 @@ function cmake.register_dap_function()
19321935
-- Build select launch target every time
19331936
return cmake.build(
19341937
{ target = config.launch_target, fargs = utils.deepcopy(opt.fargs) },
1935-
function()
1938+
function(build_result)
1939+
if not build_result:is_ok() then
1940+
return
1941+
end
19361942
result = config:get_launch_target()
19371943
local target_path = result.data
19381944
local dap_config = {

0 commit comments

Comments
 (0)