Skip to content

Ruby on Windows: RDBG_PATH error text advises pointing at the extensionless rdbg script, but that path is then spawned directly and cannot execute #508

Description

@debugmcpdev

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions