Skip to content

Commit 665df81

Browse files
committed
fix(windows): Fix powershell legacy and operator (&&)
1 parent 1698299 commit 665df81

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

lua/cmake-tools/terminal.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,7 @@ local get_command_handling_on_exit = function()
532532

533533
local exit_op = "$?"
534534
local escape_rm = " \\rm -f "
535+
local and_op = " &&"
535536

536537
if is_fish_shell() then
537538
exit_op = "$status"
@@ -540,12 +541,13 @@ local get_command_handling_on_exit = function()
540541

541542
if osys.iswin32 then
542543
exit_op = is_power_shell() and "$LASTEXITCODE" or "%errorlevel%"
544+
and_op = is_power_shell() and " -and" or " &&"
543545
escape_rm = is_power_shell() and " Remove-Item " or " del /Q "
544546
exit_code_file_path = exit_code_file_path:gsub("/", "\\")
545547
lock_file_path = lock_file_path:gsub("/", "\\")
546548
end
547549

548-
return "echo " .. exit_op .. " > " .. exit_code_file_path .. " &&" .. escape_rm .. lock_file_path
550+
return "echo " .. exit_op .. " > " .. exit_code_file_path .. and_op .. escape_rm .. lock_file_path
549551
end
550552

551553
---tries to read the number stored in get_last_exit_code_file_path() file

0 commit comments

Comments
 (0)