mirror of
https://github.com/junegunn/vim-plug
synced 2026-06-10 00:36:36 -04:00
Fix breakage to 'PlugUpgrade' under Windows PowerShell. (#1331)
Commit 09b7c0e has caused this command to emit an error during its
cleanup when run on Windows with 'shell' set to PowerShell.
The cause of the failure is that the cleanup logic passes the command
string 'rmdir /s /q' to `s:system()` (within `s:rm_rf()`). Before the
commit at fault, this command would be written to a batch file and
executed by 'cmd.exe'. After the commit, it is passed directly to
PowerShell for execution, where 'rmdir' is an alias for 'Remove-Item'
and does not support '/s' and '/q' flags.
This commit is contained in:
8
plug.vim
8
plug.vim
@@ -2469,9 +2469,11 @@ endfunction
|
|||||||
|
|
||||||
function! s:rm_rf(dir)
|
function! s:rm_rf(dir)
|
||||||
if isdirectory(a:dir)
|
if isdirectory(a:dir)
|
||||||
return s:system(s:is_win
|
return s:system(!s:is_win
|
||||||
\ ? 'rmdir /S /Q '.plug#shellescape(a:dir)
|
\ ? ['rm', '-rf', a:dir]
|
||||||
\ : ['rm', '-rf', a:dir])
|
\ : s:is_powershell(&shell)
|
||||||
|
\ ? ['Remove-Item', '-Recurse', '-Force', a:dir]
|
||||||
|
\ : 'rmdir /S /Q '.plug#shellescape(a:dir))
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user