Skip to content

Instantly share code, notes, and snippets.

@markjreed
Created September 14, 2011 21:03
Show Gist options
  • Save markjreed/1217781 to your computer and use it in GitHub Desktop.
Save markjreed/1217781 to your computer and use it in GitHub Desktop.
The script, stripped to its bare essentials, is basically a stand-in for the 'pry' executable:
$ cat mypry
#!/usr/bin/env ruby
require 'rubygems'
require 'pry'
binding.pry
When run directly, it works beautifully.
$ ruby ./mypry
From: ./mypry @ line 4 in Object#N/A:
1: #!/usr/bin/env ruby
2: require 'rubygems'
3: require 'pry'
=> 4: binding.pry
5:
pry(main)>
When run via load() after rubygems, boom:
$ ruby -rubygems -e 'load("./mypry")'
/usr/lib/ruby/gems/1.8/gems/pry-0.9.5/lib/pry/default_commands/context.rb:148:in `to_s': NULL pointer given (ArgumentError)
from /usr/lib/ruby/gems/1.8/gems/pry-0.9.5/lib/pry/default_commands/context.rb:148
from /usr/lib/ruby/gems/1.8/gems/pry-0.9.5/lib/pry/command_set.rb:17:in `instance_exec'
from /usr/lib/ruby/gems/1.8/gems/pry-0.9.5/lib/pry/command_set.rb:17:in `call'
from /usr/lib/ruby/gems/1.8/gems/pry-0.9.5/lib/pry/command_set.rb:194:in `run_command'
from /usr/lib/ruby/gems/1.8/gems/pry-0.9.5/lib/pry/command_processor.rb:166:in `execute_command'
from /usr/lib/ruby/gems/1.8/gems/pry-0.9.5/lib/pry/command_processor.rb:139:in `process_commands'
from /usr/lib/ruby/gems/1.8/gems/pry-0.9.5/lib/pry/pry_instance.rb:301:in `process_line'
from /usr/lib/ruby/gems/1.8/gems/pry-0.9.5/lib/pry.rb:15
from /usr/lib/ruby/gems/1.8/gems/pry-0.9.5/lib/pry/pry_instance.rb:109:in `call'
from /usr/lib/ruby/gems/1.8/gems/pry-0.9.5/lib/pry/pry_instance.rb:109:in `exec_hook'
from /usr/lib/ruby/gems/1.8/gems/pry-0.9.5/lib/pry/pry_instance.rb:140:in `repl_prologue'
from /usr/lib/ruby/gems/1.8/gems/pry-0.9.5/lib/pry/pry_instance.rb:173:in `repl'
from /usr/lib/ruby/gems/1.8/gems/pry-0.9.5/lib/pry/pry_class.rb:95:in `start'
from /usr/lib/ruby/gems/1.8/gems/pry-0.9.5/lib/pry/core_extensions.rb:20:in `pry'
from ./mypry:4
from -e:1:in `load'
from -e:1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment