mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Fix pry-backtrace with Pry.start, improve docs. [Fixes #379]
This commit is contained in:
parent
9c6eaafc04
commit
5ef817cc75
2 changed files with 10 additions and 2 deletions
|
@ -168,7 +168,12 @@ class Pry
|
||||||
banner <<-BANNER
|
banner <<-BANNER
|
||||||
Usage: pry-backtrace [OPTIONS] [--help]
|
Usage: pry-backtrace [OPTIONS] [--help]
|
||||||
|
|
||||||
Show the backtrace for the Pry session.
|
Show the backtrace for the position in the code where Pry was started. This can be used to
|
||||||
|
infer the behavior of the program immediately before it entered Pry, just like the backtrace
|
||||||
|
property of an exception.
|
||||||
|
|
||||||
|
(NOTE: if you are looking for the backtrace of the most recent exception raised,
|
||||||
|
just type: `_ex_.backtrace` instead, see https://github.com/pry/pry/wiki/Special-Locals)
|
||||||
|
|
||||||
e.g: pry-backtrace
|
e.g: pry-backtrace
|
||||||
BANNER
|
BANNER
|
||||||
|
|
|
@ -113,7 +113,10 @@ class Pry
|
||||||
pry_instance = new(options)
|
pry_instance = new(options)
|
||||||
|
|
||||||
# save backtrace
|
# save backtrace
|
||||||
pry_instance.backtrace = caller.tap(&:shift)
|
pry_instance.backtrace = caller
|
||||||
|
|
||||||
|
# if Pry was started via binding.pry, elide that from the backtrace.
|
||||||
|
pry_instance.backtrace.shift if pry_instance.backtrace.first =~ /pry.*core_extensions.*pry/
|
||||||
|
|
||||||
# yield the binding_stack to the hook for modification
|
# yield the binding_stack to the hook for modification
|
||||||
pry_instance.exec_hook(
|
pry_instance.exec_hook(
|
||||||
|
|
Loading…
Reference in a new issue