fix(db-*, epf-*): ошибка до запуска платформы не выдаётся за успех

Временный каталог брался из $env:TEMP, которой вне Windows нет. Join-Path
падал на привязке параметра внутри try/finally без catch: try прерывался,
finally отрабатывал, и скрипт выходил с кодом 0 — платформа не запускалась,
постусловие не проверялось (#106).

- временный каталог — [IO.Path]::GetTempPath() (на Windows тот же путь);
- верхнеуровневый trap { … exit 1 } в 15 скриптах db-*/epf-*, запускающих
  платформу: любая необработанная ошибка даёт код 1 и печатает место;
- уборка временного каталога в finally не падает на пустом пути;
- гард check-ps-portability.mjs держит оба правила.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-09-26 13:53:51 +03:00
co-authored by Claude Opus 5.5
parent 317dce6d9f
commit eb1796ef94
35 changed files with 233 additions and 79 deletions
@@ -1,4 +1,4 @@
# db-cfe-admin v1.1 — Configuration extensions in a 1C infobase: list, check, properties, delete
# db-cfe-admin v1.2 — Configuration extensions in a 1C infobase: list, check, properties, delete
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
# NB: *nix-раскладку платформы (/opt/1cv8/<ver>/1cv8, без .exe) знает только .py-порт — PS на *nix не исполняется.
<#
@@ -103,6 +103,11 @@ param(
[string[]]$AdditionalIbcmdArguments = @()
)
# Необработанная ошибка (напр. привязка параметра) внутри try/finally без catch завершала
# скрипт с кодом 0 — ложный успех без запуска платформы. Любая такая ошибка — код 1.
# py-порт: необработанное исключение и так даёт код 1.
trap { Write-Host "Error: $($_.Exception.Message) ($($_.InvocationInfo.ScriptName):$($_.InvocationInfo.ScriptLineNumber))" -ForegroundColor Red; exit 1 }
$OutputEncoding = [System.Text.Encoding]::UTF8
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
@@ -663,7 +668,7 @@ function Invoke-Designer {
Write-Host "Error: 1C executable not found at $v8Exe" -ForegroundColor Red
exit 1
}
$tempDir = Join-Path $env:TEMP "db_cfe_admin_$(Get-Random)"
$tempDir = Join-Path ([IO.Path]::GetTempPath()) "db_cfe_admin_$(Get-Random)"
New-Item -ItemType Directory -Path $tempDir -Force | Out-Null
try {
$arguments = @("DESIGNER")
@@ -694,7 +699,7 @@ function Invoke-Designer {
Output = $res.Output
}
} finally {
if (Test-Path $tempDir) { Remove-Item -Path $tempDir -Recurse -Force -ErrorAction SilentlyContinue }
if ($tempDir -and (Test-Path $tempDir)) { Remove-Item -Path $tempDir -Recurse -Force -ErrorAction SilentlyContinue }
}
}
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# db-cfe-admin v1.1 — Configuration extensions in a 1C infobase: list, check, properties, delete
# db-cfe-admin v1.2 — Configuration extensions in a 1C infobase: list, check, properties, delete
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse
@@ -1,4 +1,4 @@
# db-create v1.15 — Create 1C information base
# db-create v1.16 — Create 1C information base
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
# NB: *nix-раскладку платформы (/opt/1cv8/<ver>/1cv8, без .exe) знает только .py-порт — PS на *nix не исполняется.
<#
@@ -76,6 +76,11 @@ param(
[string[]]$AdditionalIbcmdArguments = @()
)
# Необработанная ошибка (напр. привязка параметра) внутри try/finally без catch завершала
# скрипт с кодом 0 — ложный успех без запуска платформы. Любая такая ошибка — код 1.
# py-порт: необработанное исключение и так даёт код 1.
trap { Write-Host "Error: $($_.Exception.Message) ($($_.InvocationInfo.ScriptName):$($_.InvocationInfo.ScriptLineNumber))" -ForegroundColor Red; exit 1 }
$OutputEncoding = [System.Text.Encoding]::UTF8
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
@@ -433,7 +438,7 @@ if ($UseTemplate -and -not (Test-Path $UseTemplate)) {
}
# --- Temp dir ---
$tempDir = Join-Path $env:TEMP "db_create_$(Get-Random)"
$tempDir = Join-Path ([IO.Path]::GetTempPath()) "db_create_$(Get-Random)"
New-Item -ItemType Directory -Path $tempDir -Force | Out-Null
try {
@@ -533,7 +538,7 @@ try {
exit $exitCode
} finally {
if (Test-Path $tempDir) {
if ($tempDir -and (Test-Path $tempDir)) {
Remove-Item -Path $tempDir -Recurse -Force -ErrorAction SilentlyContinue
}
}
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# db-create v1.15 — Create 1C information base
# db-create v1.16 — Create 1C information base
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse
@@ -1,4 +1,4 @@
# db-dump-cf v1.17 — Dump 1C configuration to CF file
# db-dump-cf v1.18 — Dump 1C configuration to CF file
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
# NB: *nix-раскладку платформы (/opt/1cv8/<ver>/1cv8, без .exe) знает только .py-порт — PS на *nix не исполняется.
<#
@@ -85,6 +85,11 @@ param(
[string[]]$AdditionalIbcmdArguments = @()
)
# Необработанная ошибка (напр. привязка параметра) внутри try/finally без catch завершала
# скрипт с кодом 0 — ложный успех без запуска платформы. Любая такая ошибка — код 1.
# py-порт: необработанное исключение и так даёт код 1.
trap { Write-Host "Error: $($_.Exception.Message) ($($_.InvocationInfo.ScriptName):$($_.InvocationInfo.ScriptLineNumber))" -ForegroundColor Red; exit 1 }
$OutputEncoding = [System.Text.Encoding]::UTF8
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
@@ -461,7 +466,7 @@ if ($outDir -and -not (Test-Path $outDir)) {
}
# --- Temp dir ---
$tempDir = Join-Path $env:TEMP "db_dump_cf_$(Get-Random)"
$tempDir = Join-Path ([IO.Path]::GetTempPath()) "db_dump_cf_$(Get-Random)"
New-Item -ItemType Directory -Path $tempDir -Force | Out-Null
try {
@@ -553,7 +558,7 @@ try {
exit $exitCode
} finally {
if (Test-Path $tempDir) {
if ($tempDir -and (Test-Path $tempDir)) {
Remove-Item -Path $tempDir -Recurse -Force -ErrorAction SilentlyContinue
}
}
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# db-dump-cf v1.17 — Dump 1C configuration to CF file
# db-dump-cf v1.18 — Dump 1C configuration to CF file
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse
@@ -1,4 +1,4 @@
# db-dump-dt v1.16 — Dump 1C information base to DT file
# db-dump-dt v1.17 — Dump 1C information base to DT file
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
# NB: *nix-раскладку платформы (/opt/1cv8/<ver>/1cv8, без .exe) знает только .py-порт — PS на *nix не исполняется.
<#
@@ -69,6 +69,11 @@ param(
[string[]]$AdditionalIbcmdArguments = @()
)
# Необработанная ошибка (напр. привязка параметра) внутри try/finally без catch завершала
# скрипт с кодом 0 — ложный успех без запуска платформы. Любая такая ошибка — код 1.
# py-порт: необработанное исключение и так даёт код 1.
trap { Write-Host "Error: $($_.Exception.Message) ($($_.InvocationInfo.ScriptName):$($_.InvocationInfo.ScriptLineNumber))" -ForegroundColor Red; exit 1 }
$OutputEncoding = [System.Text.Encoding]::UTF8
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
@@ -445,7 +450,7 @@ if ($outDir -and -not (Test-Path $outDir)) {
}
# --- Temp dir ---
$tempDir = Join-Path $env:TEMP "db_dump_dt_$(Get-Random)"
$tempDir = Join-Path ([IO.Path]::GetTempPath()) "db_dump_dt_$(Get-Random)"
New-Item -ItemType Directory -Path $tempDir -Force | Out-Null
try {
@@ -527,7 +532,7 @@ try {
exit $exitCode
} finally {
if (Test-Path $tempDir) {
if ($tempDir -and (Test-Path $tempDir)) {
Remove-Item -Path $tempDir -Recurse -Force -ErrorAction SilentlyContinue
}
}
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# db-dump-dt v1.16 — Dump 1C information base to DT file
# db-dump-dt v1.17 — Dump 1C information base to DT file
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse
@@ -1,4 +1,4 @@
# db-dump-xml v1.23 — Dump 1C configuration to XML files
# db-dump-xml v1.24 — Dump 1C configuration to XML files
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
# NB: *nix-раскладку платформы (/opt/1cv8/<ver>/1cv8, без .exe) знает только .py-порт — PS на *nix не исполняется.
<#
@@ -122,6 +122,11 @@ param(
[string[]]$AdditionalIbcmdArguments = @()
)
# Необработанная ошибка (напр. привязка параметра) внутри try/finally без catch завершала
# скрипт с кодом 0 — ложный успех без запуска платформы. Любая такая ошибка — код 1.
# py-порт: необработанное исключение и так даёт код 1.
trap { Write-Host "Error: $($_.Exception.Message) ($($_.InvocationInfo.ScriptName):$($_.InvocationInfo.ScriptLineNumber))" -ForegroundColor Red; exit 1 }
$OutputEncoding = [System.Text.Encoding]::UTF8
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
@@ -620,7 +625,7 @@ if (-not (Test-Path $ConfigDir)) {
}
# --- Temp dir ---
$tempDir = Join-Path $env:TEMP "db_dump_xml_$(Get-Random)"
$tempDir = Join-Path ([IO.Path]::GetTempPath()) "db_dump_xml_$(Get-Random)"
New-Item -ItemType Directory -Path $tempDir -Force | Out-Null
try {
@@ -782,7 +787,7 @@ try {
exit $exitCode
} finally {
if (Test-Path $tempDir) {
if ($tempDir -and (Test-Path $tempDir)) {
Remove-Item -Path $tempDir -Recurse -Force -ErrorAction SilentlyContinue
}
}
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# db-dump-xml v1.23 — Dump 1C configuration to XML files
# db-dump-xml v1.24 — Dump 1C configuration to XML files
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse
@@ -1,4 +1,4 @@
# db-load-cf v1.19 — Load 1C configuration from CF file
# db-load-cf v1.20 — Load 1C configuration from CF file
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
# NB: *nix-раскладку платформы (/opt/1cv8/<ver>/1cv8, без .exe) знает только .py-порт — PS на *nix не исполняется.
<#
@@ -95,6 +95,11 @@ param(
[string[]]$AdditionalIbcmdArguments = @()
)
# Необработанная ошибка (напр. привязка параметра) внутри try/finally без catch завершала
# скрипт с кодом 0 — ложный успех без запуска платформы. Любая такая ошибка — код 1.
# py-порт: необработанное исключение и так даёт код 1.
trap { Write-Host "Error: $($_.Exception.Message) ($($_.InvocationInfo.ScriptName):$($_.InvocationInfo.ScriptLineNumber))" -ForegroundColor Red; exit 1 }
$OutputEncoding = [System.Text.Encoding]::UTF8
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
@@ -472,7 +477,7 @@ function Invoke-ApplyCheck {
$exeLeaf = Split-Path $Exe -Leaf
$v8 = if ($exeLeaf -match '^ibcmd') { Join-Path $exeDir ("1cv8" + [System.IO.Path]::GetExtension($Exe)) } else { $Exe }
if (-not (Test-Path $v8)) { return @{ Skipped = $true; Reason = "1cv8 not found at $v8"; ExitCode = 0; Lines = @() } }
$dir = Join-Path $env:TEMP "apply_check_$(Get-Random)"
$dir = Join-Path ([IO.Path]::GetTempPath()) "apply_check_$(Get-Random)"
New-Item -ItemType Directory -Path $dir -Force | Out-Null
try {
$a = @("DESIGNER") + $ConnArgs + @("/CheckCanApplyConfigurationExtensions")
@@ -488,7 +493,7 @@ function Invoke-ApplyCheck {
}
return @{ Skipped = $false; Reason = ''; ExitCode = $res.ExitCode; Lines = $lines }
} finally {
if (Test-Path $dir) { Remove-Item -Path $dir -Recurse -Force -ErrorAction SilentlyContinue }
if ($dir -and (Test-Path $dir)) { Remove-Item -Path $dir -Recurse -Force -ErrorAction SilentlyContinue }
}
}
@@ -548,7 +553,7 @@ if (-not (Test-Path $InputFile)) {
}
# --- Temp dir ---
$tempDir = Join-Path $env:TEMP "db_load_cf_$(Get-Random)"
$tempDir = Join-Path ([IO.Path]::GetTempPath()) "db_load_cf_$(Get-Random)"
New-Item -ItemType Directory -Path $tempDir -Force | Out-Null
try {
@@ -646,7 +651,7 @@ try {
exit $exitCode
} finally {
if (Test-Path $tempDir) {
if ($tempDir -and (Test-Path $tempDir)) {
Remove-Item -Path $tempDir -Recurse -Force -ErrorAction SilentlyContinue
}
}
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# db-load-cf v1.19 — Load 1C configuration from CF file
# db-load-cf v1.20 — Load 1C configuration from CF file
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse
@@ -1,4 +1,4 @@
# db-load-dt v1.17 — Load 1C information base from DT file
# db-load-dt v1.18 — Load 1C information base from DT file
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
# NB: *nix-раскладку платформы (/opt/1cv8/<ver>/1cv8, без .exe) знает только .py-порт — PS на *nix не исполняется.
<#
@@ -82,6 +82,11 @@ param(
[string[]]$AdditionalIbcmdArguments = @()
)
# Необработанная ошибка (напр. привязка параметра) внутри try/finally без catch завершала
# скрипт с кодом 0 — ложный успех без запуска платформы. Любая такая ошибка — код 1.
# py-порт: необработанное исключение и так даёт код 1.
trap { Write-Host "Error: $($_.Exception.Message) ($($_.InvocationInfo.ScriptName):$($_.InvocationInfo.ScriptLineNumber))" -ForegroundColor Red; exit 1 }
$OutputEncoding = [System.Text.Encoding]::UTF8
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
@@ -468,7 +473,7 @@ if (-not (Test-Path $InputFile)) {
}
# --- Temp dir ---
$tempDir = Join-Path $env:TEMP "db_load_dt_$(Get-Random)"
$tempDir = Join-Path ([IO.Path]::GetTempPath()) "db_load_dt_$(Get-Random)"
New-Item -ItemType Directory -Path $tempDir -Force | Out-Null
try {
@@ -544,7 +549,7 @@ try {
exit $exitCode
} finally {
if (Test-Path $tempDir) {
if ($tempDir -and (Test-Path $tempDir)) {
Remove-Item -Path $tempDir -Recurse -Force -ErrorAction SilentlyContinue
}
}
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# db-load-dt v1.17 — Load 1C information base from DT file
# db-load-dt v1.18 — Load 1C information base from DT file
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse
@@ -1,4 +1,4 @@
# db-load-git v1.29 — Load Git changes into 1C database
# db-load-git v1.30 — Load Git changes into 1C database
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
# NB: *nix-раскладку платформы (/opt/1cv8/<ver>/1cv8, без .exe) знает только .py-порт — PS на *nix не исполняется.
<#
@@ -136,6 +136,11 @@ param(
[string[]]$AdditionalIbcmdArguments = @()
)
# Необработанная ошибка (напр. привязка параметра) внутри try/finally без catch завершала
# скрипт с кодом 0 — ложный успех без запуска платформы. Любая такая ошибка — код 1.
# py-порт: необработанное исключение и так даёт код 1.
trap { Write-Host "Error: $($_.Exception.Message) ($($_.InvocationInfo.ScriptName):$($_.InvocationInfo.ScriptLineNumber))" -ForegroundColor Red; exit 1 }
$OutputEncoding = [System.Text.Encoding]::UTF8
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
@@ -664,7 +669,7 @@ function Invoke-ApplyCheck {
$exeLeaf = Split-Path $Exe -Leaf
$v8 = if ($exeLeaf -match '^ibcmd') { Join-Path $exeDir ("1cv8" + [System.IO.Path]::GetExtension($Exe)) } else { $Exe }
if (-not (Test-Path $v8)) { return @{ Skipped = $true; Reason = "1cv8 not found at $v8"; ExitCode = 0; Lines = @() } }
$dir = Join-Path $env:TEMP "apply_check_$(Get-Random)"
$dir = Join-Path ([IO.Path]::GetTempPath()) "apply_check_$(Get-Random)"
New-Item -ItemType Directory -Path $dir -Force | Out-Null
try {
$a = @("DESIGNER") + $ConnArgs + @("/CheckCanApplyConfigurationExtensions")
@@ -680,7 +685,7 @@ function Invoke-ApplyCheck {
}
return @{ Skipped = $false; Reason = ''; ExitCode = $res.ExitCode; Lines = $lines }
} finally {
if (Test-Path $dir) { Remove-Item -Path $dir -Recurse -Force -ErrorAction SilentlyContinue }
if ($dir -and (Test-Path $dir)) { Remove-Item -Path $dir -Recurse -Force -ErrorAction SilentlyContinue }
}
}
@@ -911,7 +916,7 @@ if ($DryRun) {
}
# --- Temp dir ---
$tempDir = Join-Path $env:TEMP "db_load_git_$(Get-Random)"
$tempDir = Join-Path ([IO.Path]::GetTempPath()) "db_load_git_$(Get-Random)"
New-Item -ItemType Directory -Path $tempDir -Force | Out-Null
try {
@@ -1060,7 +1065,7 @@ try {
exit $exitCode
} finally {
if (Test-Path $tempDir) {
if ($tempDir -and (Test-Path $tempDir)) {
Remove-Item -Path $tempDir -Recurse -Force -ErrorAction SilentlyContinue
}
}
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# db-load-git v1.29 — Load Git changes into 1C database
# db-load-git v1.30 — Load Git changes into 1C database
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse
@@ -1,4 +1,4 @@
# db-load-xml v1.31 — Load 1C configuration from XML files
# db-load-xml v1.32 — Load 1C configuration from XML files
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
# NB: *nix-раскладку платформы (/opt/1cv8/<ver>/1cv8, без .exe) знает только .py-порт — PS на *nix не исполняется.
<#
@@ -132,6 +132,11 @@ param(
[string[]]$AdditionalIbcmdArguments = @()
)
# Необработанная ошибка (напр. привязка параметра) внутри try/finally без catch завершала
# скрипт с кодом 0 — ложный успех без запуска платформы. Любая такая ошибка — код 1.
# py-порт: необработанное исключение и так даёт код 1.
trap { Write-Host "Error: $($_.Exception.Message) ($($_.InvocationInfo.ScriptName):$($_.InvocationInfo.ScriptLineNumber))" -ForegroundColor Red; exit 1 }
$OutputEncoding = [System.Text.Encoding]::UTF8
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
@@ -627,7 +632,7 @@ function Invoke-ApplyCheck {
$exeLeaf = Split-Path $Exe -Leaf
$v8 = if ($exeLeaf -match '^ibcmd') { Join-Path $exeDir ("1cv8" + [System.IO.Path]::GetExtension($Exe)) } else { $Exe }
if (-not (Test-Path $v8)) { return @{ Skipped = $true; Reason = "1cv8 not found at $v8"; ExitCode = 0; Lines = @() } }
$dir = Join-Path $env:TEMP "apply_check_$(Get-Random)"
$dir = Join-Path ([IO.Path]::GetTempPath()) "apply_check_$(Get-Random)"
New-Item -ItemType Directory -Path $dir -Force | Out-Null
try {
$a = @("DESIGNER") + $ConnArgs + @("/CheckCanApplyConfigurationExtensions")
@@ -643,7 +648,7 @@ function Invoke-ApplyCheck {
}
return @{ Skipped = $false; Reason = ''; ExitCode = $res.ExitCode; Lines = $lines }
} finally {
if (Test-Path $dir) { Remove-Item -Path $dir -Recurse -Force -ErrorAction SilentlyContinue }
if ($dir -and (Test-Path $dir)) { Remove-Item -Path $dir -Recurse -Force -ErrorAction SilentlyContinue }
}
}
@@ -726,7 +731,7 @@ if ($Mode -eq "Partial" -and $AllExtensions) {
}
# --- Temp dir ---
$tempDir = Join-Path $env:TEMP "db_load_xml_$(Get-Random)"
$tempDir = Join-Path ([IO.Path]::GetTempPath()) "db_load_xml_$(Get-Random)"
New-Item -ItemType Directory -Path $tempDir -Force | Out-Null
try {
@@ -940,7 +945,7 @@ try {
exit $exitCode
} finally {
if (Test-Path $tempDir) {
if ($tempDir -and (Test-Path $tempDir)) {
Remove-Item -Path $tempDir -Recurse -Force -ErrorAction SilentlyContinue
}
}
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# db-load-xml v1.31 — Load 1C configuration from XML files
# db-load-xml v1.32 — Load 1C configuration from XML files
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse
+11 -6
View File
@@ -1,4 +1,4 @@
# db-repo v1.16 — 1C configuration repository operations
# db-repo v1.17 — 1C configuration repository operations
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
# NB: движок только 1cv8 — ibcmd работу с хранилищем не поддерживает (нет такого режима).
<#
@@ -176,6 +176,11 @@ param(
[string[]]$AdditionalV8Arguments = @()
)
# Необработанная ошибка (напр. привязка параметра) внутри try/finally без catch завершала
# скрипт с кодом 0 — ложный успех без запуска платформы. Любая такая ошибка — код 1.
# py-порт: необработанное исключение и так даёт код 1.
trap { Write-Host "Error: $($_.Exception.Message) ($($_.InvocationInfo.ScriptName):$($_.InvocationInfo.ScriptLineNumber))" -ForegroundColor Red; exit 1 }
$OutputEncoding = [System.Text.Encoding]::UTF8
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
function Protect-Secrets {
@@ -749,7 +754,7 @@ function Write-ReceivedWarning {
$owners = Get-OwnerObjects $Received
$hasRoot = @($Received | Where-Object { ($_ -split '\.').Count -eq 1 }).Count -gt 0
if ($owners.Count -gt 0) {
$listPath = Join-Path $env:TEMP "db-repo-received.txt"
$listPath = Join-Path ([IO.Path]::GetTempPath()) "db-repo-received.txt"
$utf8Bom = New-Object System.Text.UTF8Encoding($true)
[System.IO.File]::WriteAllLines($listPath, $owners, $utf8Bom)
Write-Host "Исходники в проекте устарели по этим объектам. Перевыгрузите их ПЕРЕД правкой," -ForegroundColor Yellow
@@ -838,7 +843,7 @@ $script:ListLimit = 20
function Save-ObjectList {
param([string[]]$Names, [string]$Key)
if (-not $Key) { $Key = 'objects' }
$path = Join-Path $env:TEMP "db-repo-$Key.txt"
$path = Join-Path ([IO.Path]::GetTempPath()) "db-repo-$Key.txt"
$utf8Bom = New-Object System.Text.UTF8Encoding($true)
[System.IO.File]::WriteAllLines($path, $Names, $utf8Bom)
return $path
@@ -1097,7 +1102,7 @@ if ($WithChildren) {
switch ($cmd) {
'report' {
# Отчёт печатается в вывод, поэтому путь нужен только если его хотят сохранить.
if (-not $OutputFile) { $OutputFile = Join-Path $env:TEMP "db-repo-report.$ReportFormat" }
if (-not $OutputFile) { $OutputFile = Join-Path ([IO.Path]::GetTempPath()) "db-repo-report.$ReportFormat" }
}
'dump-cfg' { if (-not $OutputFile) { Write-Host "Error: -OutputFile (path to the .cf file) is required for dump-cfg" -ForegroundColor Red; exit 1 } }
'add-user' { if (-not $NewUser -or -not $Rights) { Write-Host "Error: -NewUser and -Rights are required for add-user" -ForegroundColor Red; exit 1 } }
@@ -1107,7 +1112,7 @@ switch ($cmd) {
$extraArgs = @(Resolve-ExtraArgs $AdditionalV8Arguments @{})
$tempDir = Join-Path $env:TEMP "db_repo_$(Get-Random)"
$tempDir = Join-Path ([IO.Path]::GetTempPath()) "db_repo_$(Get-Random)"
New-Item -ItemType Directory -Path $tempDir -Force | Out-Null
try {
@@ -1275,7 +1280,7 @@ try {
exit $verdict
} finally {
if (Test-Path $tempDir) {
if ($tempDir -and (Test-Path $tempDir)) {
Remove-Item -Path $tempDir -Recurse -Force -ErrorAction SilentlyContinue
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# db-repo v1.16 — 1C configuration repository operations
# db-repo v1.17 — 1C configuration repository operations
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
# NB: движок только 1cv8 — ibcmd работу с хранилищем не поддерживает (нет такого режима).
"""Работа с хранилищем конфигурации 1С.
+6 -1
View File
@@ -1,4 +1,4 @@
# db-run v1.11 — Launch 1C:Enterprise
# db-run v1.12 — Launch 1C:Enterprise
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
# NB: *nix-раскладку платформы (/opt/1cv8/<ver>/1cv8, без .exe) знает только .py-порт — PS на *nix не исполняется.
<#
@@ -88,6 +88,11 @@ param(
[string[]]$AdditionalIbcmdArguments = @()
)
# Необработанная ошибка (напр. привязка параметра) внутри try/finally без catch завершала
# скрипт с кодом 0 — ложный успех без запуска платформы. Любая такая ошибка — код 1.
# py-порт: необработанное исключение и так даёт код 1.
trap { Write-Host "Error: $($_.Exception.Message) ($($_.InvocationInfo.ScriptName):$($_.InvocationInfo.ScriptLineNumber))" -ForegroundColor Red; exit 1 }
$OutputEncoding = [System.Text.Encoding]::UTF8
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
+1 -1
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# db-run v1.11 — Launch 1C:Enterprise
# db-run v1.12 — Launch 1C:Enterprise
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse
+10 -5
View File
@@ -1,4 +1,4 @@
# db-update v1.21 — Update 1C database configuration
# db-update v1.22 — Update 1C database configuration
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
# NB: *nix-раскладку платформы (/opt/1cv8/<ver>/1cv8, без .exe) знает только .py-порт — PS на *nix не исполняется.
<#
@@ -119,6 +119,11 @@ param(
[string[]]$AdditionalIbcmdArguments = @()
)
# Необработанная ошибка (напр. привязка параметра) внутри try/finally без catch завершала
# скрипт с кодом 0 — ложный успех без запуска платформы. Любая такая ошибка — код 1.
# py-порт: необработанное исключение и так даёт код 1.
trap { Write-Host "Error: $($_.Exception.Message) ($($_.InvocationInfo.ScriptName):$($_.InvocationInfo.ScriptLineNumber))" -ForegroundColor Red; exit 1 }
if ($Dynamic) { $Dynamic = if (@('on', 'yes', '+') -contains $Dynamic.ToLower()) { '+' } else { '-' } }
$OutputEncoding = [System.Text.Encoding]::UTF8
@@ -577,7 +582,7 @@ function Invoke-ApplyCheck {
$exeLeaf = Split-Path $Exe -Leaf
$v8 = if ($exeLeaf -match '^ibcmd') { Join-Path $exeDir ("1cv8" + [System.IO.Path]::GetExtension($Exe)) } else { $Exe }
if (-not (Test-Path $v8)) { return @{ Skipped = $true; Reason = "1cv8 not found at $v8"; ExitCode = 0; Lines = @() } }
$dir = Join-Path $env:TEMP "apply_check_$(Get-Random)"
$dir = Join-Path ([IO.Path]::GetTempPath()) "apply_check_$(Get-Random)"
New-Item -ItemType Directory -Path $dir -Force | Out-Null
try {
$a = @("DESIGNER") + $ConnArgs + @("/CheckCanApplyConfigurationExtensions")
@@ -593,7 +598,7 @@ function Invoke-ApplyCheck {
}
return @{ Skipped = $false; Reason = ''; ExitCode = $res.ExitCode; Lines = $lines }
} finally {
if (Test-Path $dir) { Remove-Item -Path $dir -Recurse -Force -ErrorAction SilentlyContinue }
if ($dir -and (Test-Path $dir)) { Remove-Item -Path $dir -Recurse -Force -ErrorAction SilentlyContinue }
}
}
@@ -647,7 +652,7 @@ if ($engine -eq "ibcmd") {
}
# --- Temp dir ---
$tempDir = Join-Path $env:TEMP "db_update_$(Get-Random)"
$tempDir = Join-Path ([IO.Path]::GetTempPath()) "db_update_$(Get-Random)"
New-Item -ItemType Directory -Path $tempDir -Force | Out-Null
try {
@@ -773,7 +778,7 @@ try {
exit $exitCode
} finally {
if (Test-Path $tempDir) {
if ($tempDir -and (Test-Path $tempDir)) {
Remove-Item -Path $tempDir -Recurse -Force -ErrorAction SilentlyContinue
}
}
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# db-update v1.21 — Update 1C database configuration
# db-update v1.22 — Update 1C database configuration
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse
+12 -7
View File
@@ -1,4 +1,4 @@
# epf-build v1.20 — Build external data processor or report (EPF/ERF) from XML sources
# epf-build v1.21 — Build external data processor or report (EPF/ERF) from XML sources
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
# NB: *nix-раскладку платформы (/opt/1cv8/<ver>/1cv8, без .exe) знает только .py-порт — PS на *nix не исполняется.
<#
@@ -95,6 +95,11 @@ param(
[string[]]$AdditionalIbcmdArguments = @()
)
# Необработанная ошибка (напр. привязка параметра) внутри try/finally без catch завершала
# скрипт с кодом 0 — ложный успех без запуска платформы. Любая такая ошибка — код 1.
# py-порт: необработанное исключение и так даёт код 1.
trap { Write-Host "Error: $($_.Exception.Message) ($($_.InvocationInfo.ScriptName):$($_.InvocationInfo.ScriptLineNumber))" -ForegroundColor Red; exit 1 }
$OutputEncoding = [System.Text.Encoding]::UTF8
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
@@ -517,7 +522,7 @@ function Invoke-SourceCheck {
Write-Host "[note] source check skipped: 1cv8 not found at $v8" -ForegroundColor Yellow
return $false
}
$dir = Join-Path $env:TEMP "epf_check_$(Get-Random)"
$dir = Join-Path ([IO.Path]::GetTempPath()) "epf_check_$(Get-Random)"
New-Item -ItemType Directory -Path $dir -Force | Out-Null
try {
$outFile = Join-Path $dir "check_log.txt"
@@ -550,7 +555,7 @@ function Invoke-SourceCheck {
}
return $true
} finally {
if (Test-Path $dir) { Remove-Item -Path $dir -Recurse -Force -ErrorAction SilentlyContinue }
if ($dir -and (Test-Path $dir)) { Remove-Item -Path $dir -Recurse -Force -ErrorAction SilentlyContinue }
}
}
@@ -652,7 +657,7 @@ $autoCreatedBase = $null
$checkBase = $null
$checkBasePath = $null
if (-not $InfoBasePath -and (-not $InfoBaseServer -or -not $InfoBaseRef)) {
$autoBasePath = Join-Path $env:TEMP "epf_stub_db_$(Get-Random)"
$autoBasePath = Join-Path ([IO.Path]::GetTempPath()) "epf_stub_db_$(Get-Random)"
Write-Host "No database specified. Creating temporary stub database..."
if ((New-StubBase $autoBasePath -Embed:($checkList.Count -gt 0)) -ne 0) {
# С внедрённой обработкой база падает прежде всего из-за самих исходников
@@ -671,7 +676,7 @@ if (-not $InfoBasePath -and (-not $InfoBaseServer -or -not $InfoBaseRef)) {
} elseif ($checkList.Count -gt 0) {
# Базу указали снаружи: класть проверяемую обработку в чужую конфигурацию нельзя, поэтому под
# проверку поднимается своя временная база, а сборка идёт на указанной.
$checkBase = Join-Path $env:TEMP "epf_check_db_$(Get-Random)"
$checkBase = Join-Path ([IO.Path]::GetTempPath()) "epf_check_db_$(Get-Random)"
Write-Host "Creating temporary database for the source check..."
if ((New-StubBase $checkBase -Embed) -ne 0) {
Write-Host "Error: платформа не приняла исходники при подготовке проверки — сборка отменена" -ForegroundColor Red
@@ -706,7 +711,7 @@ if ($outDir -and -not (Test-Path $outDir)) {
}
# --- Temp dir ---
$tempDir = Join-Path $env:TEMP "epf_build_$(Get-Random)"
$tempDir = Join-Path ([IO.Path]::GetTempPath()) "epf_build_$(Get-Random)"
New-Item -ItemType Directory -Path $tempDir -Force | Out-Null
try {
@@ -786,7 +791,7 @@ try {
exit $exitCode
} finally {
if (Test-Path $tempDir) {
if ($tempDir -and (Test-Path $tempDir)) {
Remove-Item -Path $tempDir -Recurse -Force -ErrorAction SilentlyContinue
}
if ($autoCreatedBase -and (Test-Path $autoCreatedBase)) {
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# epf-build v1.20 — Build external data processor or report (EPF/ERF) from XML sources
# epf-build v1.21 — Build external data processor or report (EPF/ERF) from XML sources
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse
@@ -1,4 +1,4 @@
# stub-db-create v1.12 — Create temp 1C infobase with metadata stubs for EPF/ERF build
# stub-db-create v1.13 — Create temp 1C infobase with metadata stubs for EPF/ERF build
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
param(
[Parameter(Mandatory)]
@@ -22,6 +22,11 @@ param(
[string[]]$AdditionalIbcmdArguments = @()
)
# Необработанная ошибка (напр. привязка параметра) внутри try/finally без catch завершала
# скрипт с кодом 0 — ложный успех без запуска платформы. Любая такая ошибка — код 1.
# py-порт: необработанное исключение и так даёт код 1.
trap { Write-Host "Error: $($_.Exception.Message) ($($_.InvocationInfo.ScriptName):$($_.InvocationInfo.ScriptLineNumber))" -ForegroundColor Red; exit 1 }
$ErrorActionPreference = "Stop"
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
@@ -422,7 +427,7 @@ $needCfg = $hasRefTypes -or $embedRequested -or $commonModules.Count -gt 0
# --- 2. Determine TempBasePath ---
if (-not $TempBasePath) {
$TempBasePath = Join-Path $env:TEMP "epf_stub_db_$(Get-Random)"
$TempBasePath = Join-Path ([IO.Path]::GetTempPath()) "epf_stub_db_$(Get-Random)"
}
# --- 3. If registers need a registrator, add stub document ---
@@ -1751,7 +1756,7 @@ function Format-ArgToken {
$extraArgString = -join ($extraArgs | ForEach-Object { Format-ArgToken $_ })
if ($stubEngine -eq "ibcmd") {
Write-Host "Creating infobase (ibcmd): $TempBasePath"
$ibData = Join-Path $env:TEMP "stub_data_$(Get-Random)"
$ibData = Join-Path ([IO.Path]::GetTempPath()) "stub_data_$(Get-Random)"
New-Item -ItemType Directory -Path $ibData -Force | Out-Null
$ibArgs = @("infobase", "create", "--db-path=$TempBasePath", "--create-database")
if ($needCfg) { $ibArgs += "--import=$(Join-Path $TempBasePath 'cfg')", "--apply", "--force" }
@@ -1787,7 +1792,7 @@ if ($needCfg) {
$cfgDir = Join-Path $TempBasePath "cfg"
# LoadConfigFromFiles
Write-Host "Loading configuration from files..."
$loadLog = Join-Path $env:TEMP "stub_load_log.txt"
$loadLog = Join-Path ([IO.Path]::GetTempPath()) "stub_load_log.txt"
$loadArgs = "DESIGNER /F`"$TempBasePath`" /LoadConfigFromFiles `"$cfgDir`" /Out `"$loadLog`" /DisableStartupDialogs" + $extraArgString
$proc = Invoke-PlatformProcess $V8Path @($loadArgs) -PreQuoted
if ($proc.ExitCode -ne 0) {
@@ -1799,7 +1804,7 @@ if ($needCfg) {
# UpdateDBCfg
Write-Host "Updating database configuration..."
$updateLog = Join-Path $env:TEMP "stub_update_log.txt"
$updateLog = Join-Path ([IO.Path]::GetTempPath()) "stub_update_log.txt"
$updateArgs = "DESIGNER /F`"$TempBasePath`" /UpdateDBCfg /Out `"$updateLog`" /DisableStartupDialogs" + $extraArgString
$proc = Invoke-PlatformProcess $V8Path @($updateArgs) -PreQuoted
if ($proc.ExitCode -ne 0) {
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# stub-db-create v1.12 — Create temp 1C infobase with metadata stubs for EPF/ERF build
# stub-db-create v1.13 — Create temp 1C infobase with metadata stubs for EPF/ERF build
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse
+8 -3
View File
@@ -1,4 +1,4 @@
# epf-dump v1.16 — Dump external data processor or report (EPF/ERF) to XML sources
# epf-dump v1.17 — Dump external data processor or report (EPF/ERF) to XML sources
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
# NB: *nix-раскладку платформы (/opt/1cv8/<ver>/1cv8, без .exe) знает только .py-порт — PS на *nix не исполняется.
<#
@@ -86,6 +86,11 @@ param(
[string[]]$AdditionalIbcmdArguments = @()
)
# Необработанная ошибка (напр. привязка параметра) внутри try/finally без catch завершала
# скрипт с кодом 0 — ложный успех без запуска платформы. Любая такая ошибка — код 1.
# py-порт: необработанное исключение и так даёт код 1.
trap { Write-Host "Error: $($_.Exception.Message) ($($_.InvocationInfo.ScriptName):$($_.InvocationInfo.ScriptLineNumber))" -ForegroundColor Red; exit 1 }
$OutputEncoding = [System.Text.Encoding]::UTF8
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
@@ -474,7 +479,7 @@ if (-not (Test-Path $OutputDir)) {
}
# --- Temp dir ---
$tempDir = Join-Path $env:TEMP "epf_dump_$(Get-Random)"
$tempDir = Join-Path ([IO.Path]::GetTempPath()) "epf_dump_$(Get-Random)"
New-Item -ItemType Directory -Path $tempDir -Force | Out-Null
try {
@@ -554,7 +559,7 @@ try {
exit $exitCode
} finally {
if (Test-Path $tempDir) {
if ($tempDir -and (Test-Path $tempDir)) {
Remove-Item -Path $tempDir -Recurse -Force -ErrorAction SilentlyContinue
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# epf-dump v1.16 — Dump external data processor or report (EPF/ERF) to XML sources
# epf-dump v1.17 — Dump external data processor or report (EPF/ERF) to XML sources
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
import argparse
@@ -1,4 +1,4 @@
# web-publish v1.10 — Publish 1C infobase via Apache (+_version_dir/_version_key: общий эталон db-семейства)
# web-publish v1.11 — Publish 1C infobase via Apache (+_version_dir/_version_key: общий эталон db-семейства)
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
<#
.SYNOPSIS
@@ -205,8 +205,8 @@ if (-not (Test-Path $httpdExe)) {
}
Write-Host "Apache не найден. Скачиваю..." -ForegroundColor Cyan
$tmpZip = Join-Path $env:TEMP "apache24.zip"
$tmpDir = Join-Path $env:TEMP "apache24_extract"
$tmpZip = Join-Path ([IO.Path]::GetTempPath()) "apache24.zip"
$tmpDir = Join-Path ([IO.Path]::GetTempPath()) "apache24_extract"
try {
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# web-publish v1.10 — Publish 1C infobase via Apache (+_version_dir/_version_key: общий эталон db-семейства)
# web-publish v1.11 — Publish 1C infobase via Apache (+_version_dir/_version_key: общий эталон db-семейства)
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
"""