Skip to content

v1.0.3 -- fix -ShadowClaude wrapper crash on .cmd/.ps1 shims

Choose a tag to compare

@ron2k1 ron2k1 released this 11 May 05:10

Bugfix: -ShadowClaude wrapper crash on npm-installed Claude Code

If you ran the v1.0.2 installer with -ShadowClaude and Claude Code was installed via npm, every claude invocation through the wrapper crashed with %1 is not a valid Win32 application. This release fixes that.

Root cause

Start-Process -NoNewWindow requires a true PE binary. npm ships claude as claude.cmd (and claude.ps1) shims, not claude.exe. The wrapper passed the shim path directly to Start-Process, which the OS loader rejects with ERROR_BAD_EXE_FORMAT.

Fix

  • New tools/lib/SpawnPlan.ps1 helper -- pure function that maps the resolved claude path to the correct host process:
    • .exe -> direct spawn
    • .cmd / .bat -> cmd.exe /c <path>
    • .ps1 -> powershell.exe -NoProfile -ExecutionPolicy Bypass -File <path>
  • Find-ClaudeExe now prefers extensions .exe > .cmd > .bat > .ps1 when PATH returns multiple shims (the .ps1 shim hangs on redirected stdin due to interactive-mode autodetect).
  • 14 new unit tests in tests/test-spawn-plan.ps1 cover all four extensions plus uppercase / unknown / no-extension fallthrough.

Guarantee unchanged

KILL_ON_JOB_CLOSE still applies. The Job Object is assigned to the host process (cmd.exe / powershell.exe); on Windows 8+ children inherit job membership, so the real node.exe child the shim launches is still kernel-reaped on wrapper exit. Existing tests/test-job-object.ps1 still passes (8ms reap).

Upgrade

cd $env:USERPROFILE\.claude\skills\structured-concurrency
git pull
.\tests\run-all.ps1   # 22+1 tests should pass

No re-install needed -- the wrapper script is the file that changed; the -ShadowClaude PROFILE function continues to call it.