Skip to content

Commit 11931a1

Browse files
committed
{CI} Improve input handling in pre-push git hook
Update pre-push PowerShell script to use Read-Host for input and provide a default 'Y' response when no input is given
1 parent 7af65dd commit 11931a1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

.githooks/pre-push.ps1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@ if ($mergeBase -ne $upstreamHead) {
4545
Write-Host "Would you like to automatically rebase and setup? [Y/n]" -ForegroundColor Yellow
4646

4747
try {
48-
$reader = [System.IO.StreamReader]::new("CON")
49-
$input = $reader.ReadLine()
48+
$input = Read-Host
49+
if ([string]::IsNullOrEmpty($input)) {
50+
$input = "Y"
51+
}
5052
} catch {
5153
Write-Host "Error reading input. Aborting push..." -ForegroundColor Red
5254
exit 1

0 commit comments

Comments
 (0)