Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(release): Bump to version 0.4.1 #5924

Merged
merged 2 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## [v0.4.1](https://github.com/ScoopInstaller/Scoop/compare/v0.4.0...v0.4.1) - 2024-04-25

### Bug Fixes

- **core:** Fix `Invoke-ExternalCommand` regression ([#5923](https://github.com/ScoopInstaller/Scoop/issues/5923))

## [v0.4.0](https://github.com/ScoopInstaller/Scoop/compare/v0.3.1...v0.4.0) - 2024-04-18

### Features
Expand Down
11 changes: 8 additions & 3 deletions lib/core.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -747,9 +747,14 @@ function Invoke-ExternalCommand {
}
if ($ArgumentList.Length -gt 0) {
$ArgumentList = $ArgumentList | ForEach-Object { [regex]::Split($_.Replace('"', ''), '(?<=(?<![:\w])[/-]\w+) | (?=[/-])') }
if ($FilePath -match '^((cmd|cscript|wscript|msiexec)(\.exe)?|.*\.(bat|cmd|js|vbs|wsf))$') {
$Process.StartInfo.Arguments = $ArgumentList -join ' '
} elseif ($Process.StartInfo.ArgumentList.Add) {
# Use legacy argument escaping for commands having non-standard behavior
# with regard to argument passing. `msiexec` requires some args like
# `TARGETDIR="C:\Program Files"`, which is non-standard, therefore we
# treat it as a legacy command.
# ref-1: https://learn.microsoft.com/en-us/powershell/scripting/learn/experimental-features?view=powershell-7.4#psnativecommandargumentpassing
$LegacyCommand = $FilePath -match '^((cmd|cscript|find|sqlcmd|wscript|msiexec)(\.exe)?|.*\.(bat|cmd|js|vbs|wsf))$'
$SupportArgumentList = $Process.StartInfo.PSObject.Properties.Name -contains 'ArgumentList'
if ((-not $LegacyCommand) -and $SupportArgumentList) {
# ArgumentList is supported in PowerShell 6.1 and later (built on .NET Core 2.1+)
# ref-1: https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.processstartinfo.argumentlist?view=net-6.0
# ref-2: https://docs.microsoft.com/en-us/powershell/scripting/whats-new/differences-from-windows-powershell?view=powershell-7.2#net-framework-vs-net-core
Expand Down
28 changes: 25 additions & 3 deletions test/Scoop-Decompress.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -158,24 +158,46 @@ Describe 'Decompression function' -Tag 'Scoop', 'Windows', 'Decompress' {
} elseif (!(installed lessmsi)) {
scoop install lessmsi
}
Copy-Item "$working_dir\MSITest.msi" "$working_dir\MSI Test.msi"
$test1 = "$working_dir\MSITest.msi"
$test2 = "$working_dir\MSITestNull.msi"
$test2 = "$working_dir\MSI Test.msi"
$test3 = "$working_dir\MSITestNull.msi"
}

It 'extract normal MSI file' {
It 'extract normal MSI file using msiexec' {
Mock get_config { $false }
$to = test_extract 'Expand-MsiArchive' $test1
$to | Should -Exist
"$to\MSITest\empty" | Should -Exist
(Get-ChildItem "$to\MSITest").Count | Should -Be 1
}

It 'extract empty MSI file using lessmsi' {
It 'extract normal MSI file with whitespace in path using msiexec' {
Mock get_config { $false }
$to = test_extract 'Expand-MsiArchive' $test2
$to | Should -Exist
"$to\MSITest\empty" | Should -Exist
(Get-ChildItem "$to\MSITest").Count | Should -Be 1
}

It 'extract normal MSI file using lessmsi' {
Mock get_config { $true }
$to = test_extract 'Expand-MsiArchive' $test1
$to | Should -Exist
}

It 'extract normal MSI file with whitespace in path using lessmsi' {
Mock get_config { $true }
$to = test_extract 'Expand-MsiArchive' $test2
$to | Should -Exist
}

It 'extract empty MSI file using lessmsi' {
Mock get_config { $true }
$to = test_extract 'Expand-MsiArchive' $test3
$to | Should -Exist
}

It 'works with "-Removal" switch ($removal param)' {
Mock get_config { $false }
$test1 | Should -Exist
Expand Down