Skip to content

Commit 794f8a5

Browse files
authored
builds(checkver): Exit routine earlier if error (#5025)
1 parent 53f0e9a commit 794f8a5

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
### Builds
2121

2222
- **checkver,auto-pr:** Allow passing file path ([#5019](https://github.com/ScoopInstaller/Scoop/issues/5019))
23+
- **checkver:** Exit routine earlier if error ([#5025](https://github.com/ScoopInstaller/Scoop/issues/5025))
2324

2425
### Tests
2526

bin/checkver.ps1

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -224,20 +224,20 @@ while ($in_progress -gt 0) {
224224
$ver = $Version
225225

226226
if (!$ver) {
227-
$page = (Get-Encoding($wc)).GetString($ev.SourceEventArgs.Result)
228-
$err = $ev.SourceEventArgs.Error
229-
if ($json.checkver.script) {
230-
$page = Invoke-Command ([scriptblock]::Create($json.checkver.script -join "`r`n"))
227+
if (!$regex -and $replace) {
228+
next "'replace' requires 're' or 'regex'"
229+
continue
231230
}
232-
231+
$err = $ev.SourceEventArgs.Error
233232
if ($err) {
234233
next "$($err.message)`r`nURL $url is not valid"
235234
continue
236235
}
237236

238-
if (!$regex -and $replace) {
239-
next "'replace' requires 're' or 'regex'"
240-
continue
237+
if ($json.checkver.script) {
238+
$page = Invoke-Command ([scriptblock]::Create($json.checkver.script -join "`r`n"))
239+
} else {
240+
$page = (Get-Encoding($wc)).GetString($ev.SourceEventArgs.Result)
241241
}
242242

243243
if ($jsonpath) {

0 commit comments

Comments
 (0)