rspec-interactive 0.9.2 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/rspec-interactive/client_output.rb +2 -2
- data/lib/rspec-interactive/stdio.rb +12 -7
- data/lib/rspec-interactive/version.rb +1 -1
- data/lib/rspec-interactive.rb +15 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca3d9ea9bc7a43930a9d3400a30b1c9d0bb06cc6691b70340966c8543b830646
|
4
|
+
data.tar.gz: 6f22c4c95eb720509cabb7cd3edd18277b1b68f96bdca32ab7f55ff6197c3e11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f39caa7d3669358769a1aa5f8c901bfbfafbef2d9e5854e14a3331f87bfb5065cf42c3609dcb5d84940371811ae35b6168ed46effa99da032e9d4dae8e0a85d0
|
7
|
+
data.tar.gz: 426d3c1feaec48508dfc48712914c40e278641c669a789b9902fa8a307c3ac349ed4cb580b008be8527d664cde94865d5e33b127a21192bf872f91261f3a93bc
|
data/Gemfile.lock
CHANGED
@@ -14,23 +14,28 @@ module RSpec
|
|
14
14
|
stdout_write.close
|
15
15
|
stderr_write.close
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
line
|
20
|
-
|
21
|
-
|
22
|
-
|
17
|
+
stdout_thread = Thread.new do
|
18
|
+
while line = stdout_read.gets do
|
19
|
+
output.print(line)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
stderr_thread = Thread.new do
|
24
|
+
while line = stderr_read.gets do
|
25
|
+
output.print(line)
|
23
26
|
end
|
24
27
|
end
|
25
28
|
|
26
29
|
begin
|
27
30
|
yield
|
28
31
|
ensure
|
32
|
+
# TODO: should the threads be killed here?
|
29
33
|
STDOUT.reopen stdout
|
30
34
|
STDERR.reopen stderr
|
31
35
|
end
|
32
36
|
|
33
|
-
|
37
|
+
stdout_thread.join
|
38
|
+
stderr_thread.join
|
34
39
|
end
|
35
40
|
end
|
36
41
|
end
|
data/lib/rspec-interactive.rb
CHANGED
@@ -56,6 +56,7 @@ module RSpec
|
|
56
56
|
load config_file if config_file
|
57
57
|
|
58
58
|
check_rails
|
59
|
+
trap_interrupt
|
59
60
|
configure_pry
|
60
61
|
|
61
62
|
start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
@@ -103,6 +104,17 @@ module RSpec
|
|
103
104
|
end
|
104
105
|
end
|
105
106
|
|
107
|
+
def self.trap_interrupt
|
108
|
+
trap('INT') do
|
109
|
+
if @runner
|
110
|
+
# We are on a different thread. There is a race here. Ignore nil.
|
111
|
+
@runner&.quit
|
112
|
+
else
|
113
|
+
raise Interrupt
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
106
118
|
def self.start_file_watcher
|
107
119
|
return if @configuration.watch_dirs.empty?
|
108
120
|
|
@@ -116,6 +128,9 @@ module RSpec
|
|
116
128
|
end
|
117
129
|
|
118
130
|
def self.configure_pry
|
131
|
+
# Prevent Pry from trapping too. It will break ctrl-c handling.
|
132
|
+
Pry.config.should_trap_interrupts = false
|
133
|
+
|
119
134
|
# Set up IO.
|
120
135
|
Pry.config.input = Readline
|
121
136
|
Pry.config.output = @output_stream
|
@@ -178,9 +193,6 @@ module RSpec
|
|
178
193
|
RSpec.clear_examples
|
179
194
|
RSpec.reset
|
180
195
|
@config_cache.replay_configuration
|
181
|
-
rescue Interrupt => e
|
182
|
-
@runner&.quit
|
183
|
-
raise e
|
184
196
|
ensure
|
185
197
|
@runner = nil
|
186
198
|
end
|