diff --git a/cargo-dist/templates/installer/installer.ps1.j2 b/cargo-dist/templates/installer/installer.ps1.j2 index 5e6323bcb..0ca35785b 100644 --- a/cargo-dist/templates/installer/installer.ps1.j2 +++ b/cargo-dist/templates/installer/installer.ps1.j2 @@ -92,7 +92,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -270,15 +279,15 @@ function Invoke-Installer($bin_paths, $platforms) { # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } } diff --git a/cargo-dist/tests/snapshots/akaikatana_basic.snap b/cargo-dist/tests/snapshots/akaikatana_basic.snap index 5c433b662..6db7e4490 100644 --- a/cargo-dist/tests/snapshots/akaikatana_basic.snap +++ b/cargo-dist/tests/snapshots/akaikatana_basic.snap @@ -1131,7 +1131,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -1288,15 +1297,15 @@ function Invoke-Installer($bin_paths, $platforms) { # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } } diff --git a/cargo-dist/tests/snapshots/akaikatana_one_alias_among_many_binaries.snap b/cargo-dist/tests/snapshots/akaikatana_one_alias_among_many_binaries.snap index 30cc85420..9dcccfa38 100644 --- a/cargo-dist/tests/snapshots/akaikatana_one_alias_among_many_binaries.snap +++ b/cargo-dist/tests/snapshots/akaikatana_one_alias_among_many_binaries.snap @@ -1145,7 +1145,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -1302,15 +1311,15 @@ function Invoke-Installer($bin_paths, $platforms) { # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } } diff --git a/cargo-dist/tests/snapshots/akaikatana_two_bin_aliases.snap b/cargo-dist/tests/snapshots/akaikatana_two_bin_aliases.snap index 6d9062c60..a60be799a 100644 --- a/cargo-dist/tests/snapshots/akaikatana_two_bin_aliases.snap +++ b/cargo-dist/tests/snapshots/akaikatana_two_bin_aliases.snap @@ -1159,7 +1159,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -1316,15 +1325,15 @@ function Invoke-Installer($bin_paths, $platforms) { # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } } diff --git a/cargo-dist/tests/snapshots/akaikatana_updaters.snap b/cargo-dist/tests/snapshots/akaikatana_updaters.snap index 8971a2f08..e54ebd26e 100644 --- a/cargo-dist/tests/snapshots/akaikatana_updaters.snap +++ b/cargo-dist/tests/snapshots/akaikatana_updaters.snap @@ -1139,7 +1139,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -1296,15 +1305,15 @@ function Invoke-Installer($bin_paths, $platforms) { # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } } diff --git a/cargo-dist/tests/snapshots/axolotlsay_abyss.snap b/cargo-dist/tests/snapshots/axolotlsay_abyss.snap index f20d26f55..5e80386b3 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_abyss.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_abyss.snap @@ -1131,7 +1131,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -1288,15 +1297,15 @@ function Invoke-Installer($bin_paths, $platforms) { # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } } diff --git a/cargo-dist/tests/snapshots/axolotlsay_abyss_only.snap b/cargo-dist/tests/snapshots/axolotlsay_abyss_only.snap index 84efbc61c..d5f1fb68d 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_abyss_only.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_abyss_only.snap @@ -1131,7 +1131,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -1288,15 +1297,15 @@ function Invoke-Installer($bin_paths, $platforms) { # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } } diff --git a/cargo-dist/tests/snapshots/axolotlsay_alias.snap b/cargo-dist/tests/snapshots/axolotlsay_alias.snap index 7f2cc37a4..9bf811568 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_alias.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_alias.snap @@ -1145,7 +1145,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -1302,15 +1311,15 @@ function Invoke-Installer($bin_paths, $platforms) { # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } } diff --git a/cargo-dist/tests/snapshots/axolotlsay_alias_ignores_missing_bins.snap b/cargo-dist/tests/snapshots/axolotlsay_alias_ignores_missing_bins.snap index f7307b069..a102445a8 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_alias_ignores_missing_bins.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_alias_ignores_missing_bins.snap @@ -1145,7 +1145,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -1302,15 +1311,15 @@ function Invoke-Installer($bin_paths, $platforms) { # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } } diff --git a/cargo-dist/tests/snapshots/axolotlsay_basic.snap b/cargo-dist/tests/snapshots/axolotlsay_basic.snap index e759e783e..40e6d60de 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_basic.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_basic.snap @@ -1131,7 +1131,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -1288,15 +1297,15 @@ function Invoke-Installer($bin_paths, $platforms) { # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } } diff --git a/cargo-dist/tests/snapshots/axolotlsay_basic_lies.snap b/cargo-dist/tests/snapshots/axolotlsay_basic_lies.snap index f7ce4d228..d97d0dc58 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_basic_lies.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_basic_lies.snap @@ -1134,7 +1134,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -1291,15 +1300,15 @@ function Invoke-Installer($bin_paths, $platforms) { # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } } diff --git a/cargo-dist/tests/snapshots/axolotlsay_disable_source_tarball.snap b/cargo-dist/tests/snapshots/axolotlsay_disable_source_tarball.snap index db3a8eb2f..0075d14eb 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_disable_source_tarball.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_disable_source_tarball.snap @@ -1131,7 +1131,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -1288,15 +1297,15 @@ function Invoke-Installer($bin_paths, $platforms) { # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } } diff --git a/cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap b/cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap index 3f0f1ef29..f2c055970 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap @@ -1131,7 +1131,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -1288,15 +1297,15 @@ function Invoke-Installer($bin_paths, $platforms) { # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } } diff --git a/cargo-dist/tests/snapshots/axolotlsay_generic_workspace_basic.snap b/cargo-dist/tests/snapshots/axolotlsay_generic_workspace_basic.snap index 7bf99b19c..28488a5aa 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_generic_workspace_basic.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_generic_workspace_basic.snap @@ -1126,7 +1126,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -1283,15 +1292,15 @@ function Invoke-Installer($bin_paths, $platforms) { # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } } diff --git a/cargo-dist/tests/snapshots/axolotlsay_homebrew_packages.snap b/cargo-dist/tests/snapshots/axolotlsay_homebrew_packages.snap index 59a619f37..412b2af35 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_homebrew_packages.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_homebrew_packages.snap @@ -1131,7 +1131,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -1288,15 +1297,15 @@ function Invoke-Installer($bin_paths, $platforms) { # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } } diff --git a/cargo-dist/tests/snapshots/axolotlsay_no_homebrew_publish.snap b/cargo-dist/tests/snapshots/axolotlsay_no_homebrew_publish.snap index 88214e7b8..cf347ddac 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_no_homebrew_publish.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_no_homebrew_publish.snap @@ -1131,7 +1131,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -1288,15 +1297,15 @@ function Invoke-Installer($bin_paths, $platforms) { # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } } diff --git a/cargo-dist/tests/snapshots/axolotlsay_several_aliases.snap b/cargo-dist/tests/snapshots/axolotlsay_several_aliases.snap index d286ba834..0ecbb2bc5 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_several_aliases.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_several_aliases.snap @@ -1145,7 +1145,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -1302,15 +1311,15 @@ function Invoke-Installer($bin_paths, $platforms) { # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } } diff --git a/cargo-dist/tests/snapshots/axolotlsay_ssldotcom_windows_sign.snap b/cargo-dist/tests/snapshots/axolotlsay_ssldotcom_windows_sign.snap index cfbf49a01..ed7143b1f 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_ssldotcom_windows_sign.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_ssldotcom_windows_sign.snap @@ -1071,7 +1071,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -1228,15 +1237,15 @@ function Invoke-Installer($bin_paths, $platforms) { # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } } diff --git a/cargo-dist/tests/snapshots/axolotlsay_ssldotcom_windows_sign_prod.snap b/cargo-dist/tests/snapshots/axolotlsay_ssldotcom_windows_sign_prod.snap index cfbf49a01..ed7143b1f 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_ssldotcom_windows_sign_prod.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_ssldotcom_windows_sign_prod.snap @@ -1071,7 +1071,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -1228,15 +1237,15 @@ function Invoke-Installer($bin_paths, $platforms) { # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } } diff --git a/cargo-dist/tests/snapshots/axolotlsay_updaters.snap b/cargo-dist/tests/snapshots/axolotlsay_updaters.snap index 0aec31c7a..0eef60f0c 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_updaters.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_updaters.snap @@ -1139,7 +1139,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -1296,15 +1305,15 @@ function Invoke-Installer($bin_paths, $platforms) { # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } } diff --git a/cargo-dist/tests/snapshots/axolotlsay_user_global_build_job.snap b/cargo-dist/tests/snapshots/axolotlsay_user_global_build_job.snap index a74749716..1add97a12 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_user_global_build_job.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_user_global_build_job.snap @@ -1131,7 +1131,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -1288,15 +1297,15 @@ function Invoke-Installer($bin_paths, $platforms) { # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } } diff --git a/cargo-dist/tests/snapshots/axolotlsay_user_host_job.snap b/cargo-dist/tests/snapshots/axolotlsay_user_host_job.snap index f378f5eb9..cc308653a 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_user_host_job.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_user_host_job.snap @@ -1131,7 +1131,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -1288,15 +1297,15 @@ function Invoke-Installer($bin_paths, $platforms) { # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } } diff --git a/cargo-dist/tests/snapshots/axolotlsay_user_local_build_job.snap b/cargo-dist/tests/snapshots/axolotlsay_user_local_build_job.snap index fa41c298b..cecef57b7 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_user_local_build_job.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_user_local_build_job.snap @@ -1131,7 +1131,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -1288,15 +1297,15 @@ function Invoke-Installer($bin_paths, $platforms) { # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } } diff --git a/cargo-dist/tests/snapshots/axolotlsay_user_plan_job.snap b/cargo-dist/tests/snapshots/axolotlsay_user_plan_job.snap index 80ca4f1d6..64f7cc915 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_user_plan_job.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_user_plan_job.snap @@ -1131,7 +1131,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -1288,15 +1297,15 @@ function Invoke-Installer($bin_paths, $platforms) { # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } } diff --git a/cargo-dist/tests/snapshots/axolotlsay_user_publish_job.snap b/cargo-dist/tests/snapshots/axolotlsay_user_publish_job.snap index ae0c9c276..6f5d3cf93 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_user_publish_job.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_user_publish_job.snap @@ -1131,7 +1131,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -1288,15 +1297,15 @@ function Invoke-Installer($bin_paths, $platforms) { # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } } diff --git a/cargo-dist/tests/snapshots/install_path_cargo_home.snap b/cargo-dist/tests/snapshots/install_path_cargo_home.snap index 8f15531c7..be2020b91 100644 --- a/cargo-dist/tests/snapshots/install_path_cargo_home.snap +++ b/cargo-dist/tests/snapshots/install_path_cargo_home.snap @@ -1131,7 +1131,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -1288,15 +1297,15 @@ function Invoke-Installer($bin_paths, $platforms) { # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } } diff --git a/cargo-dist/tests/snapshots/install_path_env_no_subdir.snap b/cargo-dist/tests/snapshots/install_path_env_no_subdir.snap index 35c44ad1f..8964da2e3 100644 --- a/cargo-dist/tests/snapshots/install_path_env_no_subdir.snap +++ b/cargo-dist/tests/snapshots/install_path_env_no_subdir.snap @@ -1115,7 +1115,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -1264,15 +1273,15 @@ $dest_dir = $env:CARGO_DIST_FORCE_INSTALL_DIR # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } } diff --git a/cargo-dist/tests/snapshots/install_path_env_subdir.snap b/cargo-dist/tests/snapshots/install_path_env_subdir.snap index de2590d8a..f80ac42e8 100644 --- a/cargo-dist/tests/snapshots/install_path_env_subdir.snap +++ b/cargo-dist/tests/snapshots/install_path_env_subdir.snap @@ -1115,7 +1115,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -1264,15 +1273,15 @@ $dest_dir = $env:CARGO_DIST_FORCE_INSTALL_DIR # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } } diff --git a/cargo-dist/tests/snapshots/install_path_env_subdir_space.snap b/cargo-dist/tests/snapshots/install_path_env_subdir_space.snap index 34ade6368..2072de15c 100644 --- a/cargo-dist/tests/snapshots/install_path_env_subdir_space.snap +++ b/cargo-dist/tests/snapshots/install_path_env_subdir_space.snap @@ -1115,7 +1115,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -1264,15 +1273,15 @@ $dest_dir = $env:CARGO_DIST_FORCE_INSTALL_DIR # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } } diff --git a/cargo-dist/tests/snapshots/install_path_env_subdir_space_deeper.snap b/cargo-dist/tests/snapshots/install_path_env_subdir_space_deeper.snap index 4b6909fb4..3b609f3d1 100644 --- a/cargo-dist/tests/snapshots/install_path_env_subdir_space_deeper.snap +++ b/cargo-dist/tests/snapshots/install_path_env_subdir_space_deeper.snap @@ -1115,7 +1115,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -1264,15 +1273,15 @@ $dest_dir = $env:CARGO_DIST_FORCE_INSTALL_DIR # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } } diff --git a/cargo-dist/tests/snapshots/install_path_fallback_no_env_var_set.snap b/cargo-dist/tests/snapshots/install_path_fallback_no_env_var_set.snap index ea75891d6..58d4aea2d 100644 --- a/cargo-dist/tests/snapshots/install_path_fallback_no_env_var_set.snap +++ b/cargo-dist/tests/snapshots/install_path_fallback_no_env_var_set.snap @@ -1127,7 +1127,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -1283,15 +1292,15 @@ $dest_dir = $env:CARGO_DIST_FORCE_INSTALL_DIR # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } } diff --git a/cargo-dist/tests/snapshots/install_path_home_subdir_deeper.snap b/cargo-dist/tests/snapshots/install_path_home_subdir_deeper.snap index a372a9621..945453d9d 100644 --- a/cargo-dist/tests/snapshots/install_path_home_subdir_deeper.snap +++ b/cargo-dist/tests/snapshots/install_path_home_subdir_deeper.snap @@ -1115,7 +1115,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -1264,15 +1273,15 @@ $dest_dir = $env:CARGO_DIST_FORCE_INSTALL_DIR # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } } diff --git a/cargo-dist/tests/snapshots/install_path_home_subdir_min.snap b/cargo-dist/tests/snapshots/install_path_home_subdir_min.snap index 157a3a8bc..648cfc25b 100644 --- a/cargo-dist/tests/snapshots/install_path_home_subdir_min.snap +++ b/cargo-dist/tests/snapshots/install_path_home_subdir_min.snap @@ -1115,7 +1115,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -1264,15 +1273,15 @@ $dest_dir = $env:CARGO_DIST_FORCE_INSTALL_DIR # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } } diff --git a/cargo-dist/tests/snapshots/install_path_home_subdir_space.snap b/cargo-dist/tests/snapshots/install_path_home_subdir_space.snap index 83e2c5c37..128ada8e0 100644 --- a/cargo-dist/tests/snapshots/install_path_home_subdir_space.snap +++ b/cargo-dist/tests/snapshots/install_path_home_subdir_space.snap @@ -1115,7 +1115,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -1264,15 +1273,15 @@ $dest_dir = $env:CARGO_DIST_FORCE_INSTALL_DIR # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } } diff --git a/cargo-dist/tests/snapshots/install_path_home_subdir_space_deeper.snap b/cargo-dist/tests/snapshots/install_path_home_subdir_space_deeper.snap index 5550cfff9..cf7ae70d1 100644 --- a/cargo-dist/tests/snapshots/install_path_home_subdir_space_deeper.snap +++ b/cargo-dist/tests/snapshots/install_path_home_subdir_space_deeper.snap @@ -1115,7 +1115,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -1264,15 +1273,15 @@ $dest_dir = $env:CARGO_DIST_FORCE_INSTALL_DIR # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } } diff --git a/cargo-dist/tests/snapshots/install_path_no_fallback_taken.snap b/cargo-dist/tests/snapshots/install_path_no_fallback_taken.snap index 79186ce2a..e7a8c41dd 100644 --- a/cargo-dist/tests/snapshots/install_path_no_fallback_taken.snap +++ b/cargo-dist/tests/snapshots/install_path_no_fallback_taken.snap @@ -1127,7 +1127,16 @@ function Install-Binary($install_args) { $fetched = Download "$ArtifactDownloadUrl" $platforms # FIXME: add a flag that lets the user not do this step - Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + try { + Invoke-Installer -bin_paths $fetched -platforms $platforms "$install_args" + } catch { + throw @" +We encountered an error trying to perform the installation; +please review the error messages below. + +$_ +"@ + } } function Get-TargetTriple() { @@ -1283,15 +1292,15 @@ $dest_dir = $env:CARGO_DIST_FORCE_INSTALL_DIR # Just copy the binaries from the temp location to the install dir foreach ($bin_path in $bin_paths) { $installed_file = Split-Path -Path "$bin_path" -Leaf - Copy-Item "$bin_path" -Destination "$dest_dir" - Remove-Item "$bin_path" -Recurse -Force + Copy-Item "$bin_path" -Destination "$dest_dir" -ErrorAction Stop + Remove-Item "$bin_path" -Recurse -Force -ErrorAction Stop Write-Information " $installed_file" if (($dests = $info["aliases"][$installed_file])) { $source = Join-Path "$dest_dir" "$installed_file" foreach ($dest_name in $dests) { $dest = Join-Path $dest_dir $dest_name - $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force + $null = New-Item -ItemType HardLink -Target "$source" -Path "$dest" -Force -ErrorAction Stop } } }