-
Notifications
You must be signed in to change notification settings - Fork 8
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 1.2.1 (2019-12-24) (ruby) not compatible byexample #162
Comments
I'm using |
@fnordfish thanks for the tip! I'm testing your solution but I'm still getting the same error (same version of However, I ran
So a lot of thanks! Could you confirm me that that my setting works for you? I will add it as fix in the next version (I'm going to take some time before the release because I need to figure out how to do the change without breaking older versions of As a side note I saw that you opened an issue in the IRB project (ruby/irb#241) about a spurious new line after the You can workaround it quickly with something like: >> somecode
=><...>expected output Or, >> somecode # byexample: +norm-ws
=> expected output Unfortunately I couldn't trigger it in my environment so I couldn't test it (I think that the issue happens only in I will keep an eye on that issue: if there is not response from the IRB developers I will try to add a workaround in |
I've added the byexample -l ruby \
--options="-ruby-pretty-print" \
-x-shebang "ruby:%e %p -f --nomultiline --nocolorize %a -r bundler/setup -r ./_pages/docs/docs_base.rb -r my_lib" \
$@ \
$(ruby -e 'puts Dir["_pages/**/*.{rb,md}"]') (I know, I could have used Because I'm lazy, I've added those |
BTW: Thanks for workaround, but I'd rather pin my irb dependency to a working version (1.3.0 is fine. 1.3.1 to 1.3.5 have that weird extra new line) Little note on irb dependency pin using bundler: With a Gemfile like this: # Gemfile
# ...
group :development, :test do
gem "irb", ">= 1.2.7", "< 1.3.1", platform: :mri
end I have to use If you just install a specific irb version manually like |
We found that in irb >= 1.2.0 the interpreter outputs nonsense. The use of `-f`, `--nomultiline`, `--nocolorize` and `--noreadline` fixes the problem (suggested by @fnordfish). Because `--nomultiline` and `--nocolorize` are not valid options for irb < 1.2.0, we require to detect the version of irb to properly choose the correct options. Closes #162 and closes #172
Allow the user to control if he/she wants the older behavior of irb (and default for byexample) or the new one where a newline is added after the => marker when the output is large. To maintain backward compatibility, byexamples sets this flag to false. This closes #162.
I found that IRB >= 1.2.2 added on purpose the newline after the The feature was introduced in this commit: https://github.com/ruby/irb/blob/2eb7d9cdca63a443ce220debe1b9669ffdd926db/lib/irb/context.rb#L274-L285 The idea is to fix this from |
@fnordfish I released Let me know if you find any trouble. By the way, since For example: $ byexample -l ruby '_pages/**/*.rb' '_pages/**/*.md' You need to protect those patterns with single quotes so it is |
Brilliant. Thanks! Will give at a go. |
Describe the bug
IRB/pexpect breaks in a really weird way. It seems that IRB never prints the prompts which makes
byexample
time out and instead, it prints some weird symbols/bytes.Expected behavior
It should work.
byexample version
byexample 10.0.1 (Python 3.8.5) - GNU GPLv3
irb 1.2.1 (2019-12-24)
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux-gnu]
reline
is the new lib used byirb
to implement the prompt which is probably the reason of this problem.May not be related but:
https://github.com/ruby/reline/blob/master/lib/reline.rb
ruby/reline#207
https://github.com/ruby/reline/blob/d1a7e74aa432ca1dda4e94aa1389f22c08b59c58/lib/reline/line_editor.rb#L530
The text was updated successfully, but these errors were encountered: