Last active
June 3, 2019 16:42
-
-
Save russelldavis/c6bc762ee0d576efc12f9f5a3af2ca2f to your computer and use it in GitHub Desktop.
How to debug in byebug with stdin/stdout/stderr redirected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Before calling `byebug`, run the following: | |
require 'io/console' | |
require 'byebug' | |
Readline.input = IO.console | |
Readline.output = IO.console | |
Byebug::Context.interface.instance_variable_set('@input', IO.console) | |
Byebug::Context.interface.instance_variable_set('@output', IO.console) | |
Byebug::Context.interface.instance_variable_set('@error', IO.console) | |
# This used to be built in to byebug (https://github.com/deivid-rodriguez/byebug/pull/211) | |
# but it got reverted (https://github.com/deivid-rodriguez/byebug/pull/235/commits/4e6ad09a7710d546cc771b66123c12a74126bd90). | |
# Works great for me. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment