runtime(getscript): CI: failure on powershell

Commit: 
https://github.com/vim/vim/commit/e62244f22dc81b86f76c6cf2f10a6aa3c8f1dd00
Author: Christian Brabandt <c...@256bit.org>
Date:   Sun May 11 18:30:24 2025 +0200

    runtime(getscript): CI: failure on powershell
    
    Problem:  The CheckVimScriptURL() function does not work properly on
              pwershell. Most likely this is because curl is aliased to
              Invoke-WebRequest on Powershell and redirection seems to work
              slightly different
    Solution: Disable CheckVimScriptURL() on Powershell and then simplify
              the curl download logic
    
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/runtime/autoload/getscript.vim b/runtime/autoload/getscript.vim
index 88d7a3a0e..1e3b5b39d 100644
--- a/runtime/autoload/getscript.vim
+++ b/runtime/autoload/getscript.vim
@@ -606,40 +606,24 @@ endfun
 " Check status code of scriptaddr and downloadaddr
 " return v:true if the script is downloadable or v:false in case of errors
 fun CheckVimScriptURL(script_id, src_id)
-  if !executable('curl')
+  " doesn't work with powershell
+  if !executable('curl') || &shell =~? 'pwsh\|powershell'
     return v:true
   endif
   let output = has("win32") ? ' -o NUL ' : ' -o /dev/null '
 
-  " Handle PowerShell differently
-  if &shell =~? '\<pwsh\>\|\<powershell\>'
-    " For PowerShell, use direct command output
-    let script_url = g:GetLatestVimScripts_scriptaddr . a:script_id
-    let script_cmd = 'curl -s -I -w "%{http_code}"' . output . 
shellescape(script_url)
-    let script_status = system(script_cmd)
-    let script_status = substitute(script_status, '
$', '', '')
-
-    let download_url = g:GetLatestVimScripts_downloadaddr . a:src_id
-    let download_cmd = 'curl -s -I -w "%{http_code}"' . output . 
shellescape(download_url)
-    let download_status = system(download_cmd)
-    let download_status = substitute(download_status, '
$', '', '')
-  else
-    " For other shells, use temporary files
-    let temp_script = tempname()
-    let temp_download = tempname()
-
-    let script_url = g:GetLatestVimScripts_scriptaddr . a:script_id
-    let script_cmd = 'curl -s -I -w "%{http_code}"' . output . 
shellescape(script_url) . ' >' . shellescape(temp_script)
-    call system(script_cmd)
-    let script_status = readfile(temp_script, 'b')[0]
-    call delete(temp_script)
-
-    let download_url = g:GetLatestVimScripts_downloadaddr . a:src_id
-    let download_cmd = 'curl -s -I -w "%{http_code}"' . output . 
shellescape(download_url) . ' >' . shellescape(temp_download)
-    call system(download_cmd)
-    let download_status = readfile(temp_download, 'b')[0]
-    call delete(temp_download)
-  endif
+  let temp = tempname()
+  defer delete(temp)
+  let script_url = g:GetLatestVimScripts_scriptaddr . a:script_id
+  let download_url = g:GetLatestVimScripts_downloadaddr . a:src_id
+
+  let script_cmd = 'curl -s -I -w "%{http_code}"' . output . 
shellescape(script_url) . ' >' . shellescape(temp)
+  call system(script_cmd)
+  let script_status = readfile(temp, 'b')[0]
+
+  let download_cmd = 'curl -s -I -w "%{http_code}"' . output . 
shellescape(download_url) . ' >' . shellescape(temp)
+  call system(download_cmd)
+  let download_status = readfile(temp, 'b')[0]
 
   if script_status !=# '200'
     let s:message += [ printf('Error: Failed to reach script: %s', 
a:script_id) ]
@@ -651,7 +635,7 @@ fun CheckVimScriptURL(script_id, src_id)
     return v:false
   endif
   return v:true
-endfunction
+endfun
 
 " ---------------------------------------------------------------------
 " Restore Options: {{{1

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1uE9nS-004JX7-JO%40256bit.org.

Raspunde prin e-mail lui