From e216852799c98de7f47309cc0a2ac6e294d0999c Mon Sep 17 00:00:00 2001 From: tiamat18 Date: Fri, 22 May 2026 03:21:46 -0400 Subject: [PATCH] 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. --- plug.vim | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plug.vim b/plug.vim index e98b271..d98d611 100644 --- a/plug.vim +++ b/plug.vim @@ -2469,9 +2469,11 @@ endfunction function! s:rm_rf(dir) if isdirectory(a:dir) - return s:system(s:is_win - \ ? 'rmdir /S /Q '.plug#shellescape(a:dir) - \ : ['rm', '-rf', a:dir]) + return s:system(!s:is_win + \ ? ['rm', '-rf', a:dir] + \ : s:is_powershell(&shell) + \ ? ['Remove-Item', '-Recurse', '-Force', a:dir] + \ : 'rmdir /S /Q '.plug#shellescape(a:dir)) endif endfunction