diff --git a/cargo-dist/templates/installer/installer.ps1.j2 b/cargo-dist/templates/installer/installer.ps1.j2 index 5e6323bcb..8984aec76 100644 --- a/cargo-dist/templates/installer/installer.ps1.j2 +++ b/cargo-dist/templates/installer/installer.ps1.j2 @@ -92,7 +92,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -270,15 +278,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..b1622cdd0 100644 --- a/cargo-dist/tests/snapshots/akaikatana_basic.snap +++ b/cargo-dist/tests/snapshots/akaikatana_basic.snap @@ -1131,7 +1131,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -1288,15 +1296,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..b39b003e8 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,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -1302,15 +1310,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..3e8e84953 100644 --- a/cargo-dist/tests/snapshots/akaikatana_two_bin_aliases.snap +++ b/cargo-dist/tests/snapshots/akaikatana_two_bin_aliases.snap @@ -1159,7 +1159,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -1316,15 +1324,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..8a21265be 100644 --- a/cargo-dist/tests/snapshots/akaikatana_updaters.snap +++ b/cargo-dist/tests/snapshots/akaikatana_updaters.snap @@ -1139,7 +1139,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -1296,15 +1304,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..b07e457be 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_abyss.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_abyss.snap @@ -1131,7 +1131,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -1288,15 +1296,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..6b2425167 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_abyss_only.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_abyss_only.snap @@ -1131,7 +1131,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -1288,15 +1296,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..7ef7cb5b0 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_alias.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_alias.snap @@ -1145,7 +1145,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -1302,15 +1310,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..05804becd 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,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -1302,15 +1310,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..4e65dba05 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_basic.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_basic.snap @@ -1131,7 +1131,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -1288,15 +1296,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..6dffeab3f 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_basic_lies.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_basic_lies.snap @@ -1134,7 +1134,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -1291,15 +1299,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..e305bf453 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_disable_source_tarball.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_disable_source_tarball.snap @@ -1131,7 +1131,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -1288,15 +1296,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..1bb7b2173 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap @@ -1131,7 +1131,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -1288,15 +1296,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..5106857e9 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_generic_workspace_basic.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_generic_workspace_basic.snap @@ -1126,7 +1126,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -1283,15 +1291,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..8ffc9b41c 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_homebrew_packages.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_homebrew_packages.snap @@ -1131,7 +1131,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -1288,15 +1296,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..f540b0e93 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_no_homebrew_publish.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_no_homebrew_publish.snap @@ -1131,7 +1131,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -1288,15 +1296,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..8cc008b89 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_several_aliases.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_several_aliases.snap @@ -1145,7 +1145,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -1302,15 +1310,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..c5fd720e0 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_ssldotcom_windows_sign.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_ssldotcom_windows_sign.snap @@ -1071,7 +1071,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -1228,15 +1236,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..c5fd720e0 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,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -1228,15 +1236,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..12f0620d0 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_updaters.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_updaters.snap @@ -1139,7 +1139,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -1296,15 +1304,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..bf779d136 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,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -1288,15 +1296,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..212a91da9 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_user_host_job.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_user_host_job.snap @@ -1131,7 +1131,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -1288,15 +1296,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..aa4790f12 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,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -1288,15 +1296,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..eefeee566 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_user_plan_job.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_user_plan_job.snap @@ -1131,7 +1131,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -1288,15 +1296,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..4e39b4830 100644 --- a/cargo-dist/tests/snapshots/axolotlsay_user_publish_job.snap +++ b/cargo-dist/tests/snapshots/axolotlsay_user_publish_job.snap @@ -1131,7 +1131,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -1288,15 +1296,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..636b01feb 100644 --- a/cargo-dist/tests/snapshots/install_path_cargo_home.snap +++ b/cargo-dist/tests/snapshots/install_path_cargo_home.snap @@ -1131,7 +1131,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -1288,15 +1296,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..0a35ebde7 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,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -1264,15 +1272,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..812f115e1 100644 --- a/cargo-dist/tests/snapshots/install_path_env_subdir.snap +++ b/cargo-dist/tests/snapshots/install_path_env_subdir.snap @@ -1115,7 +1115,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -1264,15 +1272,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..5592732bb 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,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -1264,15 +1272,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..b09cf3e49 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,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -1264,15 +1272,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..83f043b8f 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,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -1283,15 +1291,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..b0b1db33f 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,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -1264,15 +1272,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..48b6c3ff5 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,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -1264,15 +1272,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..3f20d9a52 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,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -1264,15 +1272,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..a40327abd 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,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -1264,15 +1272,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..a49fab853 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,15 @@ 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 above. + +"@ + } } function Get-TargetTriple() { @@ -1283,15 +1291,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 } } }