File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -94,10 +94,32 @@ def init(app_name="rake", argv = ARGV)
9494 # Backward compatibility for capistrano
9595 args = handle_options
9696 end
97+ load_debug_at_stop_feature
9798 collect_command_line_tasks ( args )
9899 end
99100 end
100101
102+ def load_debug_at_stop_feature
103+ return unless ENV [ "RAKE_DEBUG" ]
104+ require "debug/session"
105+ DEBUGGER__ ::start no_sigint_hook : true , nonstop : true
106+ Rake ::Task . prepend Module . new {
107+ def execute ( *)
108+ exception = DEBUGGER__ ::SESSION . capture_exception_frames ( /(exe|bin|lib)\/ rake/ ) do
109+ super
110+ end
111+
112+ if exception
113+ STDERR . puts exception . message
114+ DEBUGGER__ ::SESSION . enter_postmortem_session exception
115+ raise exception
116+ end
117+ end
118+ }
119+ rescue LoadError
120+ end
121+ private :load_debug_at_stop_feature
122+
101123 # Find the rakefile and then load it and any pending imports.
102124 def load_rakefile
103125 standard_exception_handling do
You can’t perform that action at this time.
0 commit comments