pry-rescue 0.11 → 0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +5 -33
- data/bin/rescue +0 -4
- data/lib/pry-rescue.rb +2 -2
- data/pry-rescue.gemspec +1 -1
- metadata +3 -2
data/README.md
CHANGED
@@ -128,32 +128,11 @@ stuck. Examples include infinite loops, slow network calls, or tests that take a
|
|
128
128
|
suprisingly long time to run.
|
129
129
|
|
130
130
|
In this case it's useful to be able to open a pry console when you notice that your
|
131
|
-
program is not going anywhere. To
|
131
|
+
program is not going anywhere. To do this, send your process a `SIGQUIT` using `<ctrl+\>`.
|
132
132
|
|
133
|
-
```
|
134
|
-
rescue --peek <script.rb>
|
135
|
-
```
|
136
|
-
|
137
|
-
Then hit `<ctrl+c>` at any time to stop your program and have a peek at what it's actually
|
138
|
-
doing. Hitting `<ctrl-c>` a second time will quit your program, if that's what you were
|
139
|
-
trying to do.
|
140
|
-
|
141
|
-
Automatic peeking
|
142
|
-
=================
|
143
|
-
|
144
|
-
Remembering to run your program with `rescue --peek` manually is a bit frustrating (as you
|
145
|
-
don't know you need to peek, until you need to peek) and so pry-rescue also allows you to
|
146
|
-
peek into any program at any time by sending it a `SIGUSR2` signal.
|
147
|
-
|
148
|
-
The easiest way to do this is to hit `<ctrl-z>` to interrupt your program, then type
|
149
|
-
`kill -SIGUSR2 %1 && fg` into bash. For example:
|
150
|
-
|
151
|
-
<!-- TODO syntax highlighting! -->
|
152
133
|
```
|
153
134
|
cirwin@localhost:/tmp/pry $ ruby examples/loop.rb
|
154
|
-
|
155
|
-
cirwin@localhost:/tmp/pry $ kill -SIGUSR2 %1 && fg
|
156
|
-
[1] + continued ./examples/loop.rb
|
135
|
+
^\
|
157
136
|
Preparing to peek via pry!
|
158
137
|
Frame number: 0/4
|
159
138
|
|
@@ -167,15 +146,6 @@ From: ./examples/loop.rb @ line 10 Object#r
|
|
167
146
|
pry (main)>
|
168
147
|
```
|
169
148
|
|
170
|
-
If you find that that's a bit hard to remember (I know I do), then you can make it easier
|
171
|
-
by adding the following alias to your `~/.bashrc` or similar:
|
172
|
-
|
173
|
-
```
|
174
|
-
alias peek='kill -SIGUSR2 %1 && fg'
|
175
|
-
```
|
176
|
-
|
177
|
-
Then you can just type `peek` instead of `kill -SIGUSR2 %1 && fg`
|
178
|
-
|
179
149
|
Advanced peeking
|
180
150
|
================
|
181
151
|
|
@@ -185,6 +155,7 @@ environment variable that suits your use-case best:
|
|
185
155
|
```
|
186
156
|
export PRY_PEEK="" # don't autopeek at all
|
187
157
|
export PRY_PEEK=INT # peek on SIGINT (<ctrl+c>)
|
158
|
+
export PRY_PEEK=QUIT # peek on SIGQUIT
|
188
159
|
export PRY_PEEK=USR1 # peek on SIGUSR1
|
189
160
|
export PRY_PEEK=USR2 # peek on SIGUSR2
|
190
161
|
export PRY_PEEK=EXIT # peek on program exit
|
@@ -194,7 +165,7 @@ If it's only important for one program, then you can also set the environment va
|
|
194
165
|
ruby before requiring pry-rescue
|
195
166
|
|
196
167
|
```ruby
|
197
|
-
ENV['PRY_PEEK'] = '' # disable
|
168
|
+
ENV['PRY_PEEK'] = '' # disable SIGQUIT handler
|
198
169
|
require "pry-rescue"
|
199
170
|
```
|
200
171
|
|
@@ -203,6 +174,7 @@ configuring ruby to always load one (or several) of these files:
|
|
203
174
|
|
204
175
|
```
|
205
176
|
export RUBYOPT=-rpry-rescue/peek/int # peek on SIGINT (<ctrl-c>)
|
177
|
+
export RUBYOPT=-rpry-rescue/peek/quit # peek on SIGQUIT (<ctrl-\>)
|
206
178
|
export RUBYOPT=-rpry-rescue/peek/usr1 # peek on SIGUSR1
|
207
179
|
export RUBYOPT=-rpry-rescue/peek/usr2 # peek on SIGUSR2
|
208
180
|
export RUBYOPT=-rpry-rescue/peek/exit # peek on program exit
|
data/bin/rescue
CHANGED
data/lib/pry-rescue.rb
CHANGED
@@ -12,9 +12,9 @@ if ENV['PRY_RESCUE_RAILS']
|
|
12
12
|
end
|
13
13
|
case ENV['PRY_PEEK']
|
14
14
|
when nil
|
15
|
-
PryRescue.peek_on_signal('
|
15
|
+
PryRescue.peek_on_signal('QUIT') unless Pry::Helpers::BaseHelpers.windows?
|
16
16
|
when ''
|
17
|
-
# explicitly disable
|
17
|
+
# explicitly disable QUIT.
|
18
18
|
else
|
19
19
|
PryRescue.peek_on_signal(ENV['PRY_PEEK'])
|
20
20
|
end
|
data/pry-rescue.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'pry-rescue'
|
3
|
-
s.version = '0.
|
3
|
+
s.version = '0.12'
|
4
4
|
s.summary = 'Open a pry session on any unhandled exceptions'
|
5
5
|
s.description = 'Allows you to wrap code in Pry::rescue{ } to open a pry session at any unhandled exceptions'
|
6
6
|
s.homepage = 'https://github.com/ConradIrwin/pry-rescue'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pry-rescue
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.12'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-10-
|
14
|
+
date: 2012-10-22 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: pry
|
@@ -165,3 +165,4 @@ signing_key:
|
|
165
165
|
specification_version: 3
|
166
166
|
summary: Open a pry session on any unhandled exceptions
|
167
167
|
test_files: []
|
168
|
+
has_rdoc:
|