Skip to content
This repository was archived by the owner on Sep 9, 2024. It is now read-only.

Commit cb2ff44

Browse files
committed
fixes ScoopInstaller#189: check for failed installs of dependencies and give a more useful error message if that's the case
1 parent bfca1ba commit cb2ff44

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

lib/install.ps1

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,23 @@ function prune_installed($apps) {
597597
$apps | ? { $installed -notcontains $_ }
598598
}
599599

600+
# check whether the app failed to install
601+
function failed($app, $global) {
602+
$ver = current_version $app
603+
if(!$ver) { return $false }
604+
$info = install_info $app $ver $global
605+
if(!$info) { return $true }
606+
return $false
607+
}
608+
609+
function ensure_none_failed($apps, $global) {
610+
foreach($app in $apps) {
611+
if(failed $app $global) {
612+
abort "$app install failed previously. please uninstall it and try again."
613+
}
614+
}
615+
}
616+
600617
# travelling directories have their contents moved from
601618
# $from to $to when the app is updated.
602619
# any files or directories that already exist in $to are skipped

libexec/scoop-install.ps1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ if($global -and !(is_admin)) {
5353

5454
ensure_none_installed $apps $global
5555

56-
$apps = install_order $apps $architecture
57-
$apps = prune_installed $apps $global
56+
$apps = install_order $apps $architecture # adds dependencies
57+
ensure_none_failed $apps $global
58+
$apps = prune_installed $apps $global # removes dependencies that are already installed
5859

5960
$apps | % { install_app $_ $architecture $global }
6061

0 commit comments

Comments
 (0)