This commit is contained in:
onysd 2026-09-11 16:59:32 +03:00
parent 4224b9d15c
commit 03de33c418
3 changed files with 39 additions and 2 deletions

View file

@ -136,6 +136,13 @@ if ($DryRun) {
}
if ($needed.Count -gt 0 -and -not $Yes) {
# Without a console there is nobody to answer, and Read-Host would block for
# as long as the caller is willing to wait -- forever, for a CI job or a
# wrapping script. Say so instead of hanging.
if ([Console]::IsInputRedirected) {
Write-Err 'no console to confirm on -- re-run with -Yes to install without asking, or -DryRun to only look'
exit 1
}
$answer = Read-Host 'Install these now? [Y/n]'
if ($answer -and $answer -notmatch '^(y|yes)$') {
Write-Err 'cancelled'