Scoop
Scoop copied to clipboard
fix(checkver) use Start-Job for manifest script to not to exit on break
Description
Change the method checkver runs manifest scripts to use Start-Job instead of Invoke-Command. When using Invoke-Command if the script calls a break the parent process will exit.
See: Do not use break outside of a loop, switch, or trap
Using break inside a pipeline break, such as a ForEach-Object script block, not only exits the pipeline, it potentially terminates the entire runspace.
Motivation and Context
Currently autoupdating is broken on all Scoop buckets that have a manifest that runs a break in the autoupdate script portion. Once one manifest is run that has issued a break the Github action will exit and the rest of the bucket will fail to update.
This change starts the manifest script as a separate job allowing the parent process to continue after the manifest script exits, and letting the github action to finish updating the buckets.
- Closes https://github.com/ScoopInstaller/GithubActions/issues/32
- Closes https://github.com/ScoopInstaller/Extras/issues/10596
- Closes https://github.com/ScoopInstaller/Extras/issues/10591
- Closes https://github.com/ScoopInstaller/Extras/issues/10592
- Closes https://github.com/ScoopInstaller/Extras/issues/10567
- Closes https://github.com/ScoopInstaller/Extras/issues/10594
- Closes https://github.com/ScoopInstaller/Extras/issues/10613
- Closes https://github.com/ScoopInstaller/Extras/issues/10622
How Has This Been Tested?
I ran the change on my copy of the current (3579b11f99c692f6b68c1ce5119b8e5d6db9f2bb) Extras repo. I have attached the output of the update here. Compare with the current log of Excavator ran during the same period:
- https://github.com/ScoopInstaller/Extras/actions/runs/4280369231/jobs/7452054609#step:3:642
See where it fails on librewolf. That manifest issues a break command. My local bucket updated 84 manifests.
Checklist:
- [x] I have read the Contributing Guide.
- [x] I have ensured that I am targeting the
developbranch. - [x] I have updated the documentation accordingly.
- [ ] I have updated the tests accordingly.
- [x] I have added an entry in the CHANGELOG.
This didn't used to happen before, did something change in GitHub Actions?
/cc @niheaven
Nope, this part hasn't been changed.
This could skip break but it omits all error message in checkver.script.
A better way is NEVER use break in checkver's script field.
This could skip
breakbut it omits all error message incheckver.script.A better way is NEVER use
breakin checkver's script field.
I disagree. randoms should not be be able to run something in the parent namespace. security says no.