Skip to content

Conversation

@vitallium
Copy link

Description

Hi! This PR adds support for capturing debuggee stdout/stderr output and forwarding it as DAP output events. On spawning (or attaching to a live process) spawn 2 background threads for reading from stdout and stderr, and redirecting data as DAP output events.

How to test

The linked issue and the fix can be easily reproduced with the Zed editor - https://zed.dev

  1. Install Zed from https://zed.dev
  2. Install the Ruby extension https://zed.dev/extensions/ruby
  3. Clone the following repo https://github.com/vitallium/rdbg-stdout-issue
  4. Install gems with bundle install
  5. Open test.rb file and hit F4 to start the debugger
  6. Choose Debug file
  7. In the panels below with the original debug gem you should not see Hello from stdout and Hello from stderr
  8. Open Gemfile and replace the original debug gem with the patched version.
  9. Install gems again with bundle install
  10. Go to the test.rb file again and hit F4 to start the debugger
  11. Now you should see Hello from stdout and Hello from stderr in the Output panel.

I understand that installing Zed and other things can be redundant so I recorded a small demo to demonstrate the fix:

rdbg_fix_stdio.mp4

Additional comments

  1. I've tested this in VSCode and everything seems to be working as usual.

Closes #1160

Let me know what do you think. Thanks!

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.

Missing DAP OutputEvents for debuggee stdout/stderr

1 participant