Skip to content

Detect installer command failures at execution time#155

Open
camjac251 wants to merge 1 commit into
andy-5:developfrom
camjac251:fix/installer-errorlevel
Open

Detect installer command failures at execution time#155
camjac251 wants to merge 1 commit into
andy-5:developfrom
camjac251:fix/installer-errorlevel

Conversation

@camjac251

Copy link
Copy Markdown

Summary

  • Replace all seven %ERRORLEVEL% comparisons with the runtime
    if errorlevel 1 form.
  • Ensure failures from mkdir and mklink are observed immediately
    and routed through the installer's existing error path.
  • Use the same error-checking idiom for the initial administrator check.

Root cause

cmd.exe expands %ERRORLEVEL% when it parses a parenthesized command
block. Six installer checks are inside if/else blocks, so they can
read the status from before the preceding mkdir or mklink command
runs. This can report OK and continue after an operation failed.

if errorlevel 1 evaluates the current command status when that
statement executes, so the check observes the operation immediately
before it.

Verification

  • Reproduced the parsing behavior with Windows cmd.exe: after a
    command returned exit status 7, the %ERRORLEVEL% form printed
    old-missed, while if errorlevel 1 printed new-detected.
  • git diff --check develop...HEAD
  • Confirmed all seven checks use if errorlevel 1 and no
    %ERRORLEVEL% checks remain.
  • Confirmed resources/install.bat retains CRLF line endings.
  • Run the installer from an elevated Windows Command Prompt in a
    disposable installation directory.

Compatibility

  • Installation paths, link targets, command ordering, and user-facing
    messages are unchanged.
  • The existing success and :error control-flow paths are unchanged.
  • The replacement uses standard cmd.exe syntax and does not require
    delayed environment-variable expansion.
  • The top-level administrator check was not affected by block expansion,
    but now uses the same error-checking form as the remaining installer.

Use the dynamic errorlevel condition inside parenthesized blocks.
Percent expansion happens when a block is parsed, so the old checks
could miss failures from the command immediately before them.
@camjac251
camjac251 marked this pull request as ready for review July 17, 2026 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant