Conversation
|
I initially planned to address it in #5124, but upon realizing that the PR was a refactoring, I decided to make it more manageable for review by separating the fix. |
|
I have tested it with almost all manifests broken by #5065 , including cygwin (dash format args) and miniconda (slash format args), this patch works in both PS5 and PS7. Those two manifests are still problematic - cygwin shows GUI and miniconda won't install to directory having a dash symbol, but that's nothing wrong with this PR, args were parsed all correctly. I don't see any existing app in offical buckets having an installer using args not starting with dash or slash. The regex is well crafted! |
Invoke-ExternalCommand()Invoke-ExternalCommand()
chawyehsu
left a comment
There was a problem hiding this comment.
I don't have any questions now, thank you for your work on this @niheaven.
Imo this is a critical part of the core therefore I suggest one more reviewer on this, but I don't know if any member is currently available. Please review when you are available. Good luck! /cc @ScoopInstaller/maintainers
|
I will merge this to develop after 24 hours for further testing. This seems to be the more appropriate approach. |
Description
Final PR for stable version (#5424)
Before handling the argument list, it splits by finding spaces that are not in a path or before params (starting with
/or-) and adding them toProcess.StartInfo.ArgumentListorProcess.StartInfo.Arguments.Example: (https://regex101.com/r/HynlRG/1)
Motivation and Context
Invoke-ExternalCommand#5065How Has This Been Tested?
Test with the following manifests, and scoop path with/without spaces.
msmpi
{ "version": "10.1.1", "description": "Microsoft implementation of the Message Passing Interface standard for developing and running parallel applications on the Windows platform.", "homepage": "https://docs.microsoft.com/en-us/message-passing-interface/microsoft-mpi", "license": "MIT", "url": "https://github.com/Microsoft/Microsoft-MPI/releases/download/v10.1.1/msmpisetup.exe", "hash": "7308fd15e437d6829fd9c6ec5d801380faa3bff6e66e1dee3e8e005106fb6a68", "pre_install": "Invoke-ExternalCommand -Path \"$(Get-HelperPath -Helper 7zip)\" -ArgumentList @('x', \"-t# `\"$dir\\msmpisetup.exe`\" -o$dir\\tmp\") | Out-Null", "architecture": { "64bit": { "installer": { "script": [ "Expand-7zipArchive \"$dir\\tmp\\4.msi\" \"$dir\"", "Remove-Item \"$dir\\msmpires.dll\"", "Remove-Item \"$dir\\msmpi.dll\"", "Rename-Item \"$dir\\msmpires64.dll\" \"$dir\\msmpires.dll\"", "Rename-Item \"$dir\\msmpi64.dll\" \"$dir\\msmpi.dll\"" ] } }, "32bit": { "installer": { "script": "Expand-7zipArchive \"$dir\\tmp\\2.msi\" \"$dir\"" } } }, "post_install": [ "Remove-Item -Recurse \"$dir\\tmp\"", "Remove-Item \"$dir\\msmpisetup.exe\"" ], "env_add_path": ".", "checkver": { "github": "https://github.com/Microsoft/Microsoft-MPI" }, "autoupdate": { "url": "https://github.com/Microsoft/Microsoft-MPI/releases/download/v$version/msmpisetup.exe" } }ida-free
{ "version": "8.3", "description": "A multi-processor disassembler and debugger that offers so many features it is hard to describe them all", "homepage": "https://hex-rays.com/ida-free/", "license": "Freeware", "architecture": { "64bit": { "url": "https://out7.hex-rays.com/files/idafree83_windows.exe", "hash": "sha1:a63fe3107846ac60fd053c4312482f79d8ab179a" } }, "pre_install": "if (!(is_admin)) { throw 'Administrator privileges are required' }", "installer": { "args": [ "--mode unattended", "--prefix $dir" ] }, "bin": "ida64.exe", "shortcuts": [ [ "ida64.exe", "IDA Freeware" ] ], "pre_uninstall": "if (!(is_admin)) { throw 'Administrator privileges are required' }", "uninstaller": { "file": "uninstall.exe", "args": [ "--mode", "unattended" ] }, "checkver": { "url": "https://hex-rays.com/ida-free/#download", "regex": "IDA\\sv([\\d.]+)\\s+" }, "autoupdate": { "architecture": { "64bit": { "url": "https://out7.hex-rays.com/files/idafree$majorVersion$minorVersion_windows.exe", "hash": { "url": "https://hex-rays.com/ida-free/#download", "regex": "$sha1\\s+$basename" } } } } }Checklist:
developbranch.