New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
irb command doesn't work in test mode #115
Comments
@ono-max can you give this a look? thx |
Thanks. I took a look at the issue. There seems to be garbled characters when Example testI used the test that @st0012 presented to me. Piece of code in utils.rb when /INTERNAL_INFO:\s(.*)/
@internal_info = JSON.parse(Regexp.last_match(1))
cmd = @queue.pop
if cmd.is_a?(Proc)
cmd.call
cmd = @queue.pop
end
if ask_cmd.include?(cmd)
write.puts(cmd)
cmd = @queue.pop
end
write.puts(cmd)
@last_backlog.clear
next # INTERNAL_INFO shouldn't be pushed into @backlog and @last_backlog
# I added lines below for debug.
when /\(rdbg\) irb/
while output = read.getc
print output
end Output$ ruby test/debug/hoge_test.rb
Loaded suite test/debug/hoge_test
Started
[1, 2] in /var/folders/kv/w1k6nh1x5fl7vx47b2pd005w0000gn/T/debugger20210625-33210-j22slv.rb
=> 1| a = 1
2| b = 2
=>#0 <main> at /var/folders/kv/w1k6nh1x5fl7vx47b2pd005w0000gn/T/debugger20210625-33210-j22slv.rb:1
INTERNAL_INFO: {"location":"/var/folders/kv/w1k6nh1x5fl7vx47b2pd005w0000gn/T/debugger20210625-33210-j22slv.rb:1","line":1}
irb
(rdbg) irb
# this is the content of `output` variable.
▽^[[63;2R |
@st0012 |
thanks for investigating. do you know why we can't see
I'm not trying to test irb. I just want to verify that the debugger can enter and exit the irb session correctly. |
No, that's why I asked you if we can test irb 😵 I've never seen anything like this before. |
I’ll give this another try. @ko1 do you have any guess on the cause? |
It seems recent irb can not control on PTY. |
tried on this script and I can't quit it (and old irb bundled with ruby 2.6 can work). require 'pty'
PTY.spawn('irb '){|r, w, pid|
puts r.readpartial(1024)
w.print "quit\r\n"
w.flush
while true
puts r.readpartial(1024)
end
} |
it seems hard so let's skip the test. |
ok let's skip the |
The
irb
command would hang without any output in the test mode:I suspect it's because the test framework doesn't support such cases yet.
Example test:
The text was updated successfully, but these errors were encountered: