Skip to content

Instantly share code, notes, and snippets.

@jeffWelling
Created October 4, 2009 19:29
Show Gist options
  • Save jeffWelling/201570 to your computer and use it in GitHub Desktop.
Save jeffWelling/201570 to your computer and use it in GitHub Desktop.
SOLVED: I have 'ARGV.concat [ "--readline" ]' in my .irbrc file, and I'm guessing that you don't
because if I comment out that line and run the tests, it works swimmingly.
(test_merge) jeff@shmee:~/Documents/Projects/ParanoidPackrat$ irb
irb(main):001:0> load 'ParanoidPackrat.rb'
=> true
irb(main):002:0> PPCommon.prompt "What color are the boots of christ?"
What color are the boots of christ? (Yes/No/Quit): Errno::ENOENT: No such file or directory - --readline
from /var/media/home/jeff/Documents/Projects/ParanoidPackrat/lib/PPCommon.rb:137:in `gets'
from /var/media/home/jeff/Documents/Projects/ParanoidPackrat/lib/PPCommon.rb:137:in `ask'
from /var/media/home/jeff/Documents/Projects/ParanoidPackrat/lib/PPCommon.rb:145:in `ask_symbol'
from /var/media/home/jeff/Documents/Projects/ParanoidPackrat/lib/PPCommon.rb:164:in `prompt'
from /var/media/home/jeff/Documents/Projects/ParanoidPackrat/lib/PPCommon.rb:163:in `loop'
from /var/media/home/jeff/Documents/Projects/ParanoidPackrat/lib/PPCommon.rb:163:in `prompt'
from (irb):2
irb(main):003:0> PPCommon.prompt "What color are the boots of christ?"
What color are the boots of christ? (Yes/No/Quit): NoMethodError: private method `gets' called for false:FalseClass
from /var/media/home/jeff/Documents/Projects/ParanoidPackrat/lib/PPCommon.rb:137:in `gets'
from /var/media/home/jeff/Documents/Projects/ParanoidPackrat/lib/PPCommon.rb:137:in `ask'
from /var/media/home/jeff/Documents/Projects/ParanoidPackrat/lib/PPCommon.rb:145:in `ask_symbol'
from /var/media/home/jeff/Documents/Projects/ParanoidPackrat/lib/PPCommon.rb:164:in `prompt'
from /var/media/home/jeff/Documents/Projects/ParanoidPackrat/lib/PPCommon.rb:163:in `loop'
from /var/media/home/jeff/Documents/Projects/ParanoidPackrat/lib/PPCommon.rb:163:in `prompt'
from (irb):3
irb(main):004:0> PPCommon.prompt "What color are the boots of christ?"
What color are the boots of christ? (Yes/No/Quit): NoMethodError: private method `gets' called for false:FalseClass
from /var/media/home/jeff/Documents/Projects/ParanoidPackrat/lib/PPCommon.rb:137:in `gets'
from /var/media/home/jeff/Documents/Projects/ParanoidPackrat/lib/PPCommon.rb:137:in `ask'
from /var/media/home/jeff/Documents/Projects/ParanoidPackrat/lib/PPCommon.rb:145:in `ask_symbol'
from /var/media/home/jeff/Documents/Projects/ParanoidPackrat/lib/PPCommon.rb:164:in `prompt'
from /var/media/home/jeff/Documents/Projects/ParanoidPackrat/lib/PPCommon.rb:163:in `loop'
from /var/media/home/jeff/Documents/Projects/ParanoidPackrat/lib/PPCommon.rb:163:in `prompt'
from (irb):4
However, changing it to use STDIN gives no errors, and your right it does seem to be whats causing
the hang to infinity as it waits for the user to hit enter.
(test_merge) jeff@shmee:~/Documents/Projects/ParanoidPackrat$ irb
irb(main):001:0> load 'ParanoidPackrat.rb'
=> true
irb(main):002:0> PPCommon.prompt "What color are the boots of christ?"
What color are the boots of christ? (Yes/No/Quit):
=> :yes
I have `ruby -v`
ruby 1.8.5 (2006-08-25) [i486-linux]
For posterity;
Title: Part of the PPCommon spec was hanging forever
TicId: a47692b9aeebb6afed109417eba454f9af85fda6
Assigned: Jeff.Welling@Gmail.com
Opened: Tue Sep 29 18:07:12 -0700 2009 (5 days)
State: OPEN
Points: no estimate
Tags: featurerequest
Comments (4):
* Added 10/04 12:52 by Jeff.Welling@Gmail.com
Hmm. For me in my environment, if I don't use STDIN I get these errors:
http://gist.github.com/201570 . If I change it to use STDIN, the errors go away
but it seems to cause that hanging forever problem. Whats different between our
two systems? I do my tests on Shmee which runs Debian, you run Debian. I have
no packages available for upgrade (or dist-upgrade).
* Added 10/04 05:26 by wnight@gmail.com
I think the problem is that it was using STDIN.gets, instead of just gets, so
overriding $stdin made no difference. It was probably hanging waiting for enter.
I've removed the STDIN and it should just work...
* Added 10/02 11:18 by wnight@gmail.com
The test code is now hanging for me, so I left it commented out. It's a problem
with wrap_io... I'll look into it.
* Added 09/29 18:07 by Jeff.Welling@Gmail.com
That part of the code has been commented out in commit
c6fd71bf05fd8fb0a78928dc9986ffe61f4ce453. wnight reports it does not hang for
him...?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment