#5057: Avoid mixing slashes for Windows temporary files

This commit is contained in:
w0rp
2026-05-14 22:30:52 +01:00
parent c809c68f7e
commit 641294465e
5 changed files with 62 additions and 10 deletions
+39
View File
@@ -0,0 +1,39 @@
Before:
runtime autoload/ale/powershell.vim
let g:ale_powershell_powershell_executable = 'pwsh'
After:
if exists('g:tempname')
call delete(g:tempname, 'rf')
endif
unlet! g:command
unlet! g:tempname
unlet! g:tempscript
unlet! g:ale_powershell_powershell_executable
runtime autoload/ale/util.vim
Execute(RunPowerShell should normalize mixed Windows temporary paths):
if has('win32')
let g:tempname = substitute(ale#util#Tempname(), '\\', '/', 'g')
function! ale#util#Tempname() abort
return g:tempname
endfunction
let g:tempscript = ale#path#GetAbsPath(g:tempname, 'script.ps1')
let g:command = ale#powershell#RunPowerShell(
\ bufnr(''),
\ 'powershell_powershell',
\ ['Write-Output ''ok'''],
\)
AssertEqual
\ ale#Escape('pwsh')
\ . ' -Exe Bypass -NoProfile -File '
\ . ale#Escape(g:tempscript)
\ . ' %t',
\ g:command
endif