Summary
buildRdbgInvocation (packages/adapter-ruby/src/utils/ruby-utils.ts:177-196) special-cases Windows .bat/.cmd shims: it strips the extension and runs the sibling extensionless rdbg Ruby script via the Ruby interpreter. When no sibling exists it throws:
Cannot run rdbg shim '<path>' directly (Windows .bat/.cmd files cannot be spawned). No sibling rdbg script found next to it. Set RDBG_PATH to the rdbg Ruby script (the extensionless file the gem installs alongside the shim).
Following that advice makes things worse, not better: an extensionless RDBG_PATH doesn't match the .bat/.cmd branch, so it falls through to return { command: rdbgPath, args } (line 195) — Node then spawn()s a Ruby script as if it were an executable, which on Windows fails (EINVAL/ENOENT), with no interpreter wrapping applied.
How this was found
Dogfooding for #492: injecting a fake rdbg via RDBG_PATH required working around this — pointing RDBG_PATH at a synthetic .bat whose sibling extensionless file is the real script, i.e. the exact inverse of what the error message tells users to do.
Expected
Either (or both):
- On win32, when
RDBG_PATH points at an extensionless existing file, wrap it with the Ruby interpreter the same way the sibling-script path does (the interpreter is already resolved and passed in as rubyPath).
- Fix the error text to advise what actually works today: point
RDBG_PATH at the .bat/.cmd shim and ensure the gem's sibling script sits next to it.
The first option is strictly better — it makes the documented advice true.
Environment
- mcp-debugger main @ 309c210, Windows 11, Ruby 3.4 (RubyInstaller), debug gem 1.11.0
Summary
buildRdbgInvocation(packages/adapter-ruby/src/utils/ruby-utils.ts:177-196) special-cases Windows.bat/.cmdshims: it strips the extension and runs the sibling extensionless rdbg Ruby script via the Ruby interpreter. When no sibling exists it throws:Following that advice makes things worse, not better: an extensionless
RDBG_PATHdoesn't match the.bat/.cmdbranch, so it falls through toreturn { command: rdbgPath, args }(line 195) — Node thenspawn()s a Ruby script as if it were an executable, which on Windows fails (EINVAL/ENOENT), with no interpreter wrapping applied.How this was found
Dogfooding for #492: injecting a fake rdbg via
RDBG_PATHrequired working around this — pointingRDBG_PATHat a synthetic.batwhose sibling extensionless file is the real script, i.e. the exact inverse of what the error message tells users to do.Expected
Either (or both):
RDBG_PATHpoints at an extensionless existing file, wrap it with the Ruby interpreter the same way the sibling-script path does (the interpreter is already resolved and passed in asrubyPath).RDBG_PATHat the.bat/.cmdshim and ensure the gem's sibling script sits next to it.The first option is strictly better — it makes the documented advice true.
Environment