listen 3.3.0.pre.3 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/listen/event/processor.rb +6 -2
- data/lib/listen/thread.rb +15 -10
- data/lib/listen/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b176ea600fdb505fc248ac0f680ca32e16aacb4c158d70bbf2a3a2f179e81cc
|
4
|
+
data.tar.gz: e3d6d42fcb64fd16149ecdfc889ac934977c5ebd3aa0b73f82efd2241a53b73a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eda24062fbec2af3e05da6ae80bc91ce6753bb4644d1fd2f2890c961bc85f7291d532d43d570def525b09987e19ff422c3746cb461583d0b597767e39d72ac2e
|
7
|
+
data.tar.gz: 82104ab7d9b6f3d5a743af79d56b9d44d60c0823c06010542049978a90d6f30ccb4145b0ec63bb3341bb823871fbfe2c32f674f19501433a4df79fc56319a430
|
data/README.md
CHANGED
@@ -16,7 +16,7 @@ The `listen` gem listens to file modifications and notifies you about the change
|
|
16
16
|
* You can watch multiple directories.
|
17
17
|
* Regexp-patterns for ignoring paths for more accuracy and speed
|
18
18
|
* Increased change detection accuracy on OS X HFS and VFAT volumes.
|
19
|
-
*
|
19
|
+
* Continuous Integration: tested on selected Ruby environments via [Github Workflows](https:///github.com/guard/listen/master/.github/workflows).
|
20
20
|
|
21
21
|
## Issues / limitations
|
22
22
|
|
@@ -114,8 +114,12 @@ module Listen
|
|
114
114
|
return if result.all?(&:empty?)
|
115
115
|
|
116
116
|
block_start = _timestamp
|
117
|
-
|
118
|
-
Listen.
|
117
|
+
exception_note = " (exception)"
|
118
|
+
::Listen::Thread.rescue_and_log('_process_changes') do
|
119
|
+
config.call(*result)
|
120
|
+
exception_note = nil
|
121
|
+
end
|
122
|
+
Listen.logger.debug "Callback#{exception_note} took #{_timestamp - block_start} sec"
|
119
123
|
end
|
120
124
|
|
121
125
|
attr_reader :config
|
data/lib/listen/thread.rb
CHANGED
@@ -9,26 +9,31 @@ module Listen
|
|
9
9
|
class << self
|
10
10
|
# Creates a new thread with the given name.
|
11
11
|
# Any exceptions raised by the thread will be logged with the thread name and complete backtrace.
|
12
|
-
def new(name)
|
12
|
+
def new(name, &block)
|
13
13
|
thread_name = "listen-#{name}"
|
14
|
-
|
15
14
|
caller_stack = caller
|
15
|
+
|
16
16
|
::Thread.new do
|
17
|
-
|
18
|
-
yield
|
19
|
-
rescue Exception => ex
|
20
|
-
_log_exception(ex, thread_name, caller_stack)
|
21
|
-
nil
|
22
|
-
end
|
17
|
+
rescue_and_log(thread_name, caller_stack: caller_stack, &block)
|
23
18
|
end.tap do |thread|
|
24
19
|
thread.name = thread_name
|
25
20
|
end
|
26
21
|
end
|
27
22
|
|
23
|
+
def rescue_and_log(method_name, *args, caller_stack: nil)
|
24
|
+
yield(*args)
|
25
|
+
rescue Exception => ex
|
26
|
+
_log_exception(ex, method_name, caller_stack: caller_stack)
|
27
|
+
end
|
28
|
+
|
28
29
|
private
|
29
30
|
|
30
|
-
def _log_exception(ex, thread_name, caller_stack)
|
31
|
-
complete_backtrace =
|
31
|
+
def _log_exception(ex, thread_name, caller_stack: nil)
|
32
|
+
complete_backtrace = if caller_stack
|
33
|
+
[*ex.backtrace, "--- Thread.new ---", *caller_stack]
|
34
|
+
else
|
35
|
+
ex.backtrace
|
36
|
+
end
|
32
37
|
message = "Exception rescued in #{thread_name}:\n#{_exception_with_causes(ex)}\n#{complete_backtrace * "\n"}"
|
33
38
|
Listen.logger.error(message)
|
34
39
|
end
|
data/lib/listen/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: listen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.0
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thibaud Guillaume-Gentil
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-11-
|
11
|
+
date: 2020-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rb-fsevent
|
@@ -110,9 +110,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
110
110
|
version: 2.2.7
|
111
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
112
|
requirements:
|
113
|
-
- - "
|
113
|
+
- - ">="
|
114
114
|
- !ruby/object:Gem::Version
|
115
|
-
version:
|
115
|
+
version: '0'
|
116
116
|
requirements: []
|
117
117
|
rubygems_version: 3.0.1
|
118
118
|
signing_key:
|