diff --git a/.claude/skills/db-load-cf/scripts/db-load-cf.ps1 b/.claude/skills/db-load-cf/scripts/db-load-cf.ps1 index 843b2ccc..6d0b629c 100644 --- a/.claude/skills/db-load-cf/scripts/db-load-cf.ps1 +++ b/.claude/skills/db-load-cf/scripts/db-load-cf.ps1 @@ -1,4 +1,4 @@ -# db-load-cf v1.6 — Load 1C configuration from CF file +# db-load-cf v1.7 — Load 1C configuration from CF file # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills # NB: *nix-раскладку платформы (/opt/1cv8//1cv8, без .exe) знает только .py-порт — PS на *nix не исполняется. <# @@ -76,6 +76,23 @@ param( $OutputEncoding = [System.Text.Encoding]::UTF8 [Console]::OutputEncoding = [System.Text.Encoding]::UTF8 +function Get-ExitAnnotation { + # Annotate an abnormal process exit code so a crash isn't reported as a bare number. + # A batch DESIGNER that crashes (e.g. missing license) may leave the infobase locked or + # half-updated — surface that instead of a plain code. (Windows exception codes only; + # POSIX signals are handled in the .py port.) + param([int]$Code) + $win = @{ + -1073741819 = "0xC0000005 (access violation)" + -1073741515 = "0xC0000135 (missing DLL)" + -1073740791 = "0xC0000409 (stack overrun)" + } + if ($win.ContainsKey($Code)) { + return " — abnormal termination $($win[$Code]); the platform crashed; the infobase may be left in an inconsistent state" + } + return "" +} + # --- Resolve V8Path --- function Find-ProjectV8Path { $dir = (Get-Location).Path @@ -190,7 +207,7 @@ try { if ($exitCode -eq 0) { Write-Host "Configuration loaded successfully from: $InputFile" -ForegroundColor Green } else { - Write-Host "Error loading configuration (code: $exitCode)" -ForegroundColor Red + Write-Host "Error loading configuration (code: $exitCode)$(Get-ExitAnnotation $exitCode)" -ForegroundColor Red } if ($output) { Write-Host ($output | Out-String) } exit $exitCode @@ -232,7 +249,7 @@ try { if ($exitCode -eq 0) { Write-Host "Configuration loaded successfully from: $InputFile" -ForegroundColor Green } else { - Write-Host "Error loading configuration (code: $exitCode)" -ForegroundColor Red + Write-Host "Error loading configuration (code: $exitCode)$(Get-ExitAnnotation $exitCode)" -ForegroundColor Red } if (Test-Path $outFile) { diff --git a/.claude/skills/db-load-cf/scripts/db-load-cf.py b/.claude/skills/db-load-cf/scripts/db-load-cf.py index f233518b..2fb9ee9d 100644 --- a/.claude/skills/db-load-cf/scripts/db-load-cf.py +++ b/.claude/skills/db-load-cf/scripts/db-load-cf.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# db-load-cf v1.6 — Load 1C configuration from CF file +# db-load-cf v1.7 — Load 1C configuration from CF file # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse @@ -99,6 +99,31 @@ def run_ibcmd(cmd, has_username=False, warn_no_user=True): return subprocess.run(cmd, input="", capture_output=True, encoding="utf-8", errors="replace") +def describe_exit(code): + """Annotate an abnormal process exit code so a crash isn't reported as a bare number. + Batch 1C in a broken/headless environment (no GUI session, no license) can crash mid-run + instead of returning a clean error, possibly leaving the infobase locked or half-mutated.""" + if code is None: + return "" + win = { + 3221225477: "0xC0000005 (access violation)", -1073741819: "0xC0000005 (access violation)", + 3221225781: "0xC0000135 (missing DLL)", -1073741515: "0xC0000135 (missing DLL)", + 3221226505: "0xC0000409 (stack overrun)", -1073740791: "0xC0000409 (stack overrun)", + } + if code in win: + return f" — abnormal termination {win[code]}; the platform crashed; the infobase may be left in an inconsistent state" + if -64 <= code < 0: + try: + import signal + name = signal.Signals(-code).name + except (ValueError, AttributeError): + name = f"signal {-code}" + return (f" — terminated by {name}; the platform crashed abnormally " + "(often a headless environment without a GUI session or license); " + "the infobase may be left in an inconsistent state") + return "" + + def main(): sys.stdout.reconfigure(encoding="utf-8") sys.stderr.reconfigure(encoding="utf-8") @@ -155,7 +180,7 @@ def main(): if result.returncode == 0: print(f"Configuration loaded successfully from: {args.InputFile}") else: - print(f"Error loading configuration (code: {result.returncode})", file=sys.stderr) + print(f"Error loading configuration (code: {result.returncode}){describe_exit(result.returncode)}", file=sys.stderr) if result.stdout: print(result.stdout) if result.stderr: @@ -206,7 +231,7 @@ def main(): if exit_code == 0: print(f"Configuration loaded successfully from: {args.InputFile}") else: - print(f"Error loading configuration (code: {exit_code})", file=sys.stderr) + print(f"Error loading configuration (code: {exit_code}){describe_exit(exit_code)}", file=sys.stderr) if os.path.isfile(out_file): try: diff --git a/.claude/skills/db-load-dt/scripts/db-load-dt.ps1 b/.claude/skills/db-load-dt/scripts/db-load-dt.ps1 index e7d79bd2..58cde48d 100644 --- a/.claude/skills/db-load-dt/scripts/db-load-dt.ps1 +++ b/.claude/skills/db-load-dt/scripts/db-load-dt.ps1 @@ -1,4 +1,4 @@ -# db-load-dt v1.5 — Load 1C information base from DT file +# db-load-dt v1.6 — Load 1C information base from DT file # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills # NB: *nix-раскладку платформы (/opt/1cv8//1cv8, без .exe) знает только .py-порт — PS на *nix не исполняется. <# @@ -73,6 +73,23 @@ param( $OutputEncoding = [System.Text.Encoding]::UTF8 [Console]::OutputEncoding = [System.Text.Encoding]::UTF8 +function Get-ExitAnnotation { + # Annotate an abnormal process exit code so a crash isn't reported as a bare number. + # A batch DESIGNER that crashes (e.g. missing license) may leave the infobase locked or + # half-updated — surface that instead of a plain code. (Windows exception codes only; + # POSIX signals are handled in the .py port.) + param([int]$Code) + $win = @{ + -1073741819 = "0xC0000005 (access violation)" + -1073741515 = "0xC0000135 (missing DLL)" + -1073740791 = "0xC0000409 (stack overrun)" + } + if ($win.ContainsKey($Code)) { + return " — abnormal termination $($win[$Code]); the platform crashed; the infobase may be left in an inconsistent state" + } + return "" +} + # --- Resolve V8Path --- function Find-ProjectV8Path { $dir = (Get-Location).Path @@ -184,7 +201,7 @@ try { if ($exitCode -eq 0) { Write-Host "Information base restored successfully from: $InputFile" -ForegroundColor Green } else { - Write-Host "Error restoring information base (code: $exitCode)" -ForegroundColor Red + Write-Host "Error restoring information base (code: $exitCode)$(Get-ExitAnnotation $exitCode)" -ForegroundColor Red } if ($output) { Write-Host ($output | Out-String) } exit $exitCode @@ -221,7 +238,7 @@ try { if ($exitCode -eq 0) { Write-Host "Information base restored successfully from: $InputFile" -ForegroundColor Green } else { - Write-Host "Error restoring information base (code: $exitCode)" -ForegroundColor Red + Write-Host "Error restoring information base (code: $exitCode)$(Get-ExitAnnotation $exitCode)" -ForegroundColor Red } if (Test-Path $outFile) { diff --git a/.claude/skills/db-load-dt/scripts/db-load-dt.py b/.claude/skills/db-load-dt/scripts/db-load-dt.py index a9f77bf7..9fb0f01c 100644 --- a/.claude/skills/db-load-dt/scripts/db-load-dt.py +++ b/.claude/skills/db-load-dt/scripts/db-load-dt.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# db-load-dt v1.5 — Load 1C information base from DT file +# db-load-dt v1.6 — Load 1C information base from DT file # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse @@ -99,6 +99,31 @@ def run_ibcmd(cmd, has_username=False, warn_no_user=True): return subprocess.run(cmd, input="", capture_output=True, encoding="utf-8", errors="replace") +def describe_exit(code): + """Annotate an abnormal process exit code so a crash isn't reported as a bare number. + Batch 1C in a broken/headless environment (no GUI session, no license) can crash mid-run + instead of returning a clean error, possibly leaving the infobase locked or half-mutated.""" + if code is None: + return "" + win = { + 3221225477: "0xC0000005 (access violation)", -1073741819: "0xC0000005 (access violation)", + 3221225781: "0xC0000135 (missing DLL)", -1073741515: "0xC0000135 (missing DLL)", + 3221226505: "0xC0000409 (stack overrun)", -1073740791: "0xC0000409 (stack overrun)", + } + if code in win: + return f" — abnormal termination {win[code]}; the platform crashed; the infobase may be left in an inconsistent state" + if -64 <= code < 0: + try: + import signal + name = signal.Signals(-code).name + except (ValueError, AttributeError): + name = f"signal {-code}" + return (f" — terminated by {name}; the platform crashed abnormally " + "(often a headless environment without a GUI session or license); " + "the infobase may be left in an inconsistent state") + return "" + + def main(): sys.stdout.reconfigure(encoding="utf-8") sys.stderr.reconfigure(encoding="utf-8") @@ -152,7 +177,7 @@ def main(): if result.returncode == 0: print(f"Information base restored successfully from: {args.InputFile}") else: - print(f"Error restoring information base (code: {result.returncode})", file=sys.stderr) + print(f"Error restoring information base (code: {result.returncode}){describe_exit(result.returncode)}", file=sys.stderr) if result.stdout: print(result.stdout) if result.stderr: @@ -201,7 +226,7 @@ def main(): if exit_code == 0: print(f"Information base restored successfully from: {args.InputFile}") else: - print(f"Error restoring information base (code: {exit_code})", file=sys.stderr) + print(f"Error restoring information base (code: {exit_code}){describe_exit(exit_code)}", file=sys.stderr) if os.path.isfile(out_file): try: diff --git a/.claude/skills/db-load-git/scripts/db-load-git.ps1 b/.claude/skills/db-load-git/scripts/db-load-git.ps1 index ac6a6b88..efdaca25 100644 --- a/.claude/skills/db-load-git/scripts/db-load-git.ps1 +++ b/.claude/skills/db-load-git/scripts/db-load-git.ps1 @@ -1,4 +1,4 @@ -# db-load-git v1.11 — Load Git changes into 1C database +# db-load-git v1.12 — Load Git changes into 1C database # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills # NB: *nix-раскладку платформы (/opt/1cv8//1cv8, без .exe) знает только .py-порт — PS на *nix не исполняется. <# @@ -108,6 +108,23 @@ param( $OutputEncoding = [System.Text.Encoding]::UTF8 [Console]::OutputEncoding = [System.Text.Encoding]::UTF8 +function Get-ExitAnnotation { + # Annotate an abnormal process exit code so a crash isn't reported as a bare number. + # A batch DESIGNER that crashes (e.g. missing license) may leave the infobase locked or + # half-updated — surface that instead of a plain code. (Windows exception codes only; + # POSIX signals are handled in the .py port.) + param([int]$Code) + $win = @{ + -1073741819 = "0xC0000005 (access violation)" + -1073741515 = "0xC0000135 (missing DLL)" + -1073740791 = "0xC0000409 (stack overrun)" + } + if ($win.ContainsKey($Code)) { + return " — abnormal termination $($win[$Code]); the platform crashed; the infobase may be left in an inconsistent state" + } + return "" +} + # --- Helper: map sub-file path (BSL, HTML, etc.) to object XML --- function Get-ObjectXmlFromSubFile { param([string]$RelativePath) @@ -377,7 +394,7 @@ try { $output = $__ib.Output $exitCode = $__ib.ExitCode if ($exitCode -ne 0) { - Write-Host "Error loading changes (code: $exitCode)" -ForegroundColor Red + Write-Host "Error loading changes (code: $exitCode)$(Get-ExitAnnotation $exitCode)" -ForegroundColor Red if ($output) { Write-Host ($output | Out-String) } exit $exitCode } @@ -395,7 +412,7 @@ try { if ($exitCode -eq 0) { Write-Host "Database configuration updated successfully" -ForegroundColor Green } else { - Write-Host "Error updating database configuration (code: $exitCode)" -ForegroundColor Red + Write-Host "Error updating database configuration (code: $exitCode)$(Get-ExitAnnotation $exitCode)" -ForegroundColor Red } if ($applyOut) { Write-Host ($applyOut | Out-String) } } @@ -456,7 +473,7 @@ try { if ($exitCode -eq 0) { Write-Host "Load completed successfully" -ForegroundColor Green } else { - Write-Host "Error loading configuration (code: $exitCode)" -ForegroundColor Red + Write-Host "Error loading configuration (code: $exitCode)$(Get-ExitAnnotation $exitCode)" -ForegroundColor Red } if (Test-Path $outFile) { diff --git a/.claude/skills/db-load-git/scripts/db-load-git.py b/.claude/skills/db-load-git/scripts/db-load-git.py index 3efb0a4e..36d9be43 100644 --- a/.claude/skills/db-load-git/scripts/db-load-git.py +++ b/.claude/skills/db-load-git/scripts/db-load-git.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# db-load-git v1.11 — Load Git changes into 1C database +# db-load-git v1.12 — Load Git changes into 1C database # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse @@ -121,6 +121,31 @@ def run_git(config_dir, git_args): return [] +def describe_exit(code): + """Annotate an abnormal process exit code so a crash isn't reported as a bare number. + Batch 1C in a broken/headless environment (no GUI session, no license) can crash mid-run + instead of returning a clean error, possibly leaving the infobase locked or half-mutated.""" + if code is None: + return "" + win = { + 3221225477: "0xC0000005 (access violation)", -1073741819: "0xC0000005 (access violation)", + 3221225781: "0xC0000135 (missing DLL)", -1073741515: "0xC0000135 (missing DLL)", + 3221226505: "0xC0000409 (stack overrun)", -1073740791: "0xC0000409 (stack overrun)", + } + if code in win: + return f" — abnormal termination {win[code]}; the platform crashed; the infobase may be left in an inconsistent state" + if -64 <= code < 0: + try: + import signal + name = signal.Signals(-code).name + except (ValueError, AttributeError): + name = f"signal {-code}" + return (f" — terminated by {name}; the platform crashed abnormally " + "(often a headless environment without a GUI session or license); " + "the infobase may be left in an inconsistent state") + return "" + + def main(): sys.stdout.reconfigure(encoding="utf-8") sys.stderr.reconfigure(encoding="utf-8") @@ -310,7 +335,7 @@ def main(): print(f"Running: ibcmd {' '.join(arguments)}") result = run_ibcmd([v8path] + arguments, bool(args.UserName)) if result.returncode != 0: - print(f"Error loading changes (code: {result.returncode})", file=sys.stderr) + print(f"Error loading changes (code: {result.returncode}){describe_exit(result.returncode)}", file=sys.stderr) if result.stdout: print(result.stdout) if result.stderr: @@ -333,7 +358,7 @@ def main(): if exit_code == 0: print("Database configuration updated successfully") else: - print(f"Error updating database configuration (code: {exit_code})", file=sys.stderr) + print(f"Error updating database configuration (code: {exit_code}){describe_exit(exit_code)}", file=sys.stderr) if ar.stdout: print(ar.stdout) if ar.stderr: @@ -396,7 +421,7 @@ def main(): if exit_code == 0: print("Load completed successfully") else: - print(f"Error loading configuration (code: {exit_code})", file=sys.stderr) + print(f"Error loading configuration (code: {exit_code}){describe_exit(exit_code)}", file=sys.stderr) if os.path.isfile(out_file): try: diff --git a/.claude/skills/db-load-xml/scripts/db-load-xml.ps1 b/.claude/skills/db-load-xml/scripts/db-load-xml.ps1 index 05210807..ebf16b94 100644 --- a/.claude/skills/db-load-xml/scripts/db-load-xml.ps1 +++ b/.claude/skills/db-load-xml/scripts/db-load-xml.ps1 @@ -1,4 +1,4 @@ -# db-load-xml v1.12 — Load 1C configuration from XML files +# db-load-xml v1.13 — Load 1C configuration from XML files # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills # NB: *nix-раскладку платформы (/opt/1cv8//1cv8, без .exe) знает только .py-порт — PS на *nix не исполняется. <# @@ -108,6 +108,23 @@ param( $OutputEncoding = [System.Text.Encoding]::UTF8 [Console]::OutputEncoding = [System.Text.Encoding]::UTF8 +function Get-ExitAnnotation { + # Annotate an abnormal process exit code so a crash isn't reported as a bare number. + # A batch DESIGNER that crashes (e.g. missing license) may leave the infobase locked or + # half-updated — surface that instead of a plain code. (Windows exception codes only; + # POSIX signals are handled in the .py port.) + param([int]$Code) + $win = @{ + -1073741819 = "0xC0000005 (access violation)" + -1073741515 = "0xC0000135 (missing DLL)" + -1073740791 = "0xC0000409 (stack overrun)" + } + if ($win.ContainsKey($Code)) { + return " — abnormal termination $($win[$Code]); the platform crashed; the infobase may be left in an inconsistent state" + } + return "" +} + # --- Resolve V8Path --- function Find-ProjectV8Path { $dir = (Get-Location).Path @@ -249,7 +266,7 @@ try { $output = $__ib.Output $exitCode = $__ib.ExitCode if ($exitCode -ne 0) { - Write-Host "Error loading configuration from files (code: $exitCode)" -ForegroundColor Red + Write-Host "Error loading configuration from files (code: $exitCode)$(Get-ExitAnnotation $exitCode)" -ForegroundColor Red if ($output) { Write-Host ($output | Out-String) } exit $exitCode } @@ -268,7 +285,7 @@ try { if ($exitCode -eq 0) { Write-Host "Database configuration updated successfully" -ForegroundColor Green } else { - Write-Host "Error updating database configuration (code: $exitCode)" -ForegroundColor Red + Write-Host "Error updating database configuration (code: $exitCode)$(Get-ExitAnnotation $exitCode)" -ForegroundColor Red } if ($applyOut) { Write-Host ($applyOut | Out-String) } } @@ -392,7 +409,7 @@ try { if ($exitCode -eq 0) { Write-Host "Load completed successfully" -ForegroundColor Green } else { - Write-Host "Error loading configuration (code: $exitCode)" -ForegroundColor Red + Write-Host "Error loading configuration (code: $exitCode)$(Get-ExitAnnotation $exitCode)" -ForegroundColor Red } if ($logContent) { diff --git a/.claude/skills/db-load-xml/scripts/db-load-xml.py b/.claude/skills/db-load-xml/scripts/db-load-xml.py index f40f83fa..e5c84977 100644 --- a/.claude/skills/db-load-xml/scripts/db-load-xml.py +++ b/.claude/skills/db-load-xml/scripts/db-load-xml.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# db-load-xml v1.12 — Load 1C configuration from XML files +# db-load-xml v1.13 — Load 1C configuration from XML files # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse @@ -99,6 +99,31 @@ def run_ibcmd(cmd, has_username=False, warn_no_user=True): return subprocess.run(cmd, input="", capture_output=True, encoding="utf-8", errors="replace") +def describe_exit(code): + """Annotate an abnormal process exit code so a crash isn't reported as a bare number. + Batch 1C in a broken/headless environment (no GUI session, no license) can crash mid-run + instead of returning a clean error, possibly leaving the infobase locked or half-mutated.""" + if code is None: + return "" + win = { + 3221225477: "0xC0000005 (access violation)", -1073741819: "0xC0000005 (access violation)", + 3221225781: "0xC0000135 (missing DLL)", -1073741515: "0xC0000135 (missing DLL)", + 3221226505: "0xC0000409 (stack overrun)", -1073740791: "0xC0000409 (stack overrun)", + } + if code in win: + return f" — abnormal termination {win[code]}; the platform crashed; the infobase may be left in an inconsistent state" + if -64 <= code < 0: + try: + import signal + name = signal.Signals(-code).name + except (ValueError, AttributeError): + name = f"signal {-code}" + return (f" — terminated by {name}; the platform crashed abnormally " + "(often a headless environment without a GUI session or license); " + "the infobase may be left in an inconsistent state") + return "" + + def main(): sys.stdout.reconfigure(encoding="utf-8") sys.stderr.reconfigure(encoding="utf-8") @@ -202,7 +227,7 @@ def main(): print(f"Running: ibcmd {' '.join(arguments)}") result = run_ibcmd([v8path] + arguments, bool(args.UserName)) if result.returncode != 0: - print(f"Error loading configuration from files (code: {result.returncode})", file=sys.stderr) + print(f"Error loading configuration from files (code: {result.returncode}){describe_exit(result.returncode)}", file=sys.stderr) if result.stdout: print(result.stdout) if result.stderr: @@ -225,7 +250,7 @@ def main(): if exit_code == 0: print("Database configuration updated successfully") else: - print(f"Error updating database configuration (code: {exit_code})", file=sys.stderr) + print(f"Error updating database configuration (code: {exit_code}){describe_exit(exit_code)}", file=sys.stderr) if ar.stdout: print(ar.stdout) if ar.stderr: @@ -352,7 +377,7 @@ def main(): if exit_code == 0: print("Load completed successfully") else: - print(f"Error loading configuration (code: {exit_code})", file=sys.stderr) + print(f"Error loading configuration (code: {exit_code}){describe_exit(exit_code)}", file=sys.stderr) if log_content: print("--- Log ---") diff --git a/.claude/skills/db-update/scripts/db-update.ps1 b/.claude/skills/db-update/scripts/db-update.ps1 index aec0fffa..99ab137a 100644 --- a/.claude/skills/db-update/scripts/db-update.ps1 +++ b/.claude/skills/db-update/scripts/db-update.ps1 @@ -1,4 +1,4 @@ -# db-update v1.6 — Update 1C database configuration +# db-update v1.7 — Update 1C database configuration # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills # NB: *nix-раскладку платформы (/opt/1cv8//1cv8, без .exe) знает только .py-порт — PS на *nix не исполняется. <# @@ -89,6 +89,23 @@ param( $OutputEncoding = [System.Text.Encoding]::UTF8 [Console]::OutputEncoding = [System.Text.Encoding]::UTF8 +function Get-ExitAnnotation { + # Annotate an abnormal process exit code so a crash isn't reported as a bare number. + # A batch DESIGNER that crashes (e.g. missing license) may leave the infobase locked or + # half-updated — surface that instead of a plain code. (Windows exception codes only; + # POSIX signals are handled in the .py port.) + param([int]$Code) + $win = @{ + -1073741819 = "0xC0000005 (access violation)" + -1073741515 = "0xC0000135 (missing DLL)" + -1073740791 = "0xC0000409 (stack overrun)" + } + if ($win.ContainsKey($Code)) { + return " — abnormal termination $($win[$Code]); the platform crashed; the infobase may be left in an inconsistent state" + } + return "" +} + # --- Resolve V8Path --- function Find-ProjectV8Path { $dir = (Get-Location).Path @@ -198,7 +215,7 @@ try { if ($exitCode -eq 0) { Write-Host "Database configuration updated successfully" -ForegroundColor Green } else { - Write-Host "Error updating database configuration (code: $exitCode)" -ForegroundColor Red + Write-Host "Error updating database configuration (code: $exitCode)$(Get-ExitAnnotation $exitCode)" -ForegroundColor Red } if ($output) { Write-Host ($output | Out-String) } exit $exitCode @@ -251,7 +268,7 @@ try { if ($exitCode -eq 0) { Write-Host "Database configuration updated successfully" -ForegroundColor Green } else { - Write-Host "Error updating database configuration (code: $exitCode)" -ForegroundColor Red + Write-Host "Error updating database configuration (code: $exitCode)$(Get-ExitAnnotation $exitCode)" -ForegroundColor Red } if (Test-Path $outFile) { diff --git a/.claude/skills/db-update/scripts/db-update.py b/.claude/skills/db-update/scripts/db-update.py index 97a03151..96f2368e 100644 --- a/.claude/skills/db-update/scripts/db-update.py +++ b/.claude/skills/db-update/scripts/db-update.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# db-update v1.6 — Update 1C database configuration +# db-update v1.7 — Update 1C database configuration # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse @@ -99,6 +99,31 @@ def run_ibcmd(cmd, has_username=False, warn_no_user=True): return subprocess.run(cmd, input="", capture_output=True, encoding="utf-8", errors="replace") +def describe_exit(code): + """Annotate an abnormal process exit code so a crash isn't reported as a bare number. + Batch 1C in a broken/headless environment (no GUI session, no license) can crash mid-run + instead of returning a clean error, possibly leaving the infobase locked or half-mutated.""" + if code is None: + return "" + win = { + 3221225477: "0xC0000005 (access violation)", -1073741819: "0xC0000005 (access violation)", + 3221225781: "0xC0000135 (missing DLL)", -1073741515: "0xC0000135 (missing DLL)", + 3221226505: "0xC0000409 (stack overrun)", -1073740791: "0xC0000409 (stack overrun)", + } + if code in win: + return f" — abnormal termination {win[code]}; the platform crashed; the infobase may be left in an inconsistent state" + if -64 <= code < 0: + try: + import signal + name = signal.Signals(-code).name + except (ValueError, AttributeError): + name = f"signal {-code}" + return (f" — terminated by {name}; the platform crashed abnormally " + "(often a headless environment without a GUI session or license); " + "the infobase may be left in an inconsistent state") + return "" + + def main(): sys.stdout.reconfigure(encoding="utf-8") sys.stderr.reconfigure(encoding="utf-8") @@ -156,7 +181,7 @@ def main(): if result.returncode == 0: print("Database configuration updated successfully") else: - print(f"Error updating database configuration (code: {result.returncode})", file=sys.stderr) + print(f"Error updating database configuration (code: {result.returncode}){describe_exit(result.returncode)}", file=sys.stderr) if result.stdout: print(result.stdout) if result.stderr: @@ -215,7 +240,7 @@ def main(): if exit_code == 0: print("Database configuration updated successfully") else: - print(f"Error updating database configuration (code: {exit_code})", file=sys.stderr) + print(f"Error updating database configuration (code: {exit_code}){describe_exit(exit_code)}", file=sys.stderr) if os.path.isfile(out_file): try: