From 77b66cc8905e1872f550ff833d4d531a9f2a527c Mon Sep 17 00:00:00 2001 From: Hsiao-nan Cheung Date: Mon, 25 Mar 2024 19:19:44 +0800 Subject: [PATCH] fix(core): Fix arguments parsing method of `Invoke-ExternalCommand()` (#5839) --- CHANGELOG.md | 1 + lib/core.ps1 | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78cc9684b4..70904eb80c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,7 @@ - **config:** Warn users about misconfigured GitHub token ([#5777](https://github.com/ScoopInstaller/Scoop/issues/5777)) - **update/uninstall:** Remove items from PATH correctly ([#5833](https://github.com/ScoopInstaller/Scoop/issues/5833)) - **shim:** Allow GUI applications to attach to the shell's console when launched using the GUI shim ([#5721](https://github.com/ScoopInstaller/Scoop/issues/5721)) +- **core:** Fix arguments parsing method of `Invoke-ExternalCommand()` ([#5839](https://github.com/ScoopInstaller/Scoop/issues/5839)) ### Performance Improvements diff --git a/lib/core.ps1 b/lib/core.ps1 index 24b6c8b0c7..525a4951e4 100644 --- a/lib/core.ps1 +++ b/lib/core.ps1 @@ -600,8 +600,7 @@ function Invoke-ExternalCommand { [CmdletBinding(DefaultParameterSetName = "Default")] [OutputType([Boolean])] param ( - [Parameter(Mandatory = $true, - Position = 0)] + [Parameter(Mandatory = $true, Position = 0)] [Alias("Path")] [ValidateNotNullOrEmpty()] [String] @@ -651,6 +650,7 @@ function Invoke-ExternalCommand { $Process.StartInfo.WindowStyle = [System.Diagnostics.ProcessWindowStyle]::Hidden } if ($ArgumentList.Length -gt 0) { + $ArgumentList = $ArgumentList | ForEach-Object { [regex]::Split($_.Replace('"', ''), '(?<=(?