Beta_cartrigesg_bd Beta v0.7

This commit is contained in:
2026-07-26 15:31:02 +03:00
parent 49cb071d0d
commit 7e6927eacc
3 changed files with 327 additions and 17 deletions

View File

@@ -76,17 +76,23 @@ function Invoke-Psql {
'--command', $Sql
)
if ($Capture) {
$output = & $PsqlPath @arguments 2>&1
if ($LASTEXITCODE -ne 0) {
throw ($output -join [Environment]::NewLine)
$output = & $PsqlPath @arguments 2>&1
$exitCode = $LASTEXITCODE
$outputText = ($output -join [Environment]::NewLine).Trim()
if ($exitCode -ne 0) {
if ($outputText -eq '') {
$outputText = "psql завершился с кодом $exitCode."
}
return ($output -join [Environment]::NewLine).Trim()
throw $outputText
}
& $PsqlPath @arguments
if ($LASTEXITCODE -ne 0) {
throw "psql завершился с кодом $LASTEXITCODE."
if ($Capture) {
return $outputText
}
if ($outputText -ne '') {
Write-Host $outputText
}
}
@@ -152,9 +158,14 @@ $testArguments = @(
'--set', 'ON_ERROR_STOP=1',
'--command', 'SELECT 1;'
)
& $PsqlPath @testArguments | Out-Null
if ($LASTEXITCODE -ne 0) {
throw 'Не удалось проверить подключение с учётными данными приложения.'
$testOutput = & $PsqlPath @testArguments 2>&1
$testExitCode = $LASTEXITCODE
if ($testExitCode -ne 0) {
$testOutputText = ($testOutput -join [Environment]::NewLine).Trim()
if ($testOutputText -eq '') {
$testOutputText = "psql завершился с кодом $testExitCode."
}
throw "Не удалось проверить подключение с учётными данными приложения. $testOutputText"
}
$configDirectory = Split-Path -Parent $ConfigPath