eventmachine-tail 0.6.1 → 0.6.2
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.
- data/lib/em/filetail.rb +15 -11
- metadata +9 -10
- data/test/logrotate.conf +0 -4
data/lib/em/filetail.rb
CHANGED
@@ -180,7 +180,7 @@ class EventMachine::FileTail
|
|
180
180
|
private
|
181
181
|
def open
|
182
182
|
return if @closed
|
183
|
-
@file.close if @file
|
183
|
+
@file.close if @file && !@file.closed?
|
184
184
|
return unless File.exists?(@path)
|
185
185
|
begin
|
186
186
|
@logger.debug "Opening file #{@path}"
|
@@ -255,21 +255,25 @@ class EventMachine::FileTail
|
|
255
255
|
private
|
256
256
|
def read
|
257
257
|
return if @closed
|
258
|
+
|
259
|
+
data = nil
|
258
260
|
@logger.debug "#{self}: Reading..."
|
259
261
|
begin
|
260
262
|
data = @file.sysread(CHUNKSIZE)
|
261
|
-
|
262
|
-
|
263
|
-
# Won't get here if sysread throws EOF
|
264
|
-
@position += data.length
|
265
|
-
@naptime = 0
|
266
|
-
|
267
|
-
# Subclasses should implement receive_data
|
268
|
-
receive_data(data)
|
269
|
-
schedule_next_read
|
270
|
-
rescue EOFError
|
263
|
+
rescue EOFError, IOError
|
271
264
|
schedule_eof
|
265
|
+
return
|
272
266
|
end
|
267
|
+
|
268
|
+
data.force_encoding(@file.external_encoding) if FORCE_ENCODING
|
269
|
+
|
270
|
+
# Won't get here if sysread throws EOF
|
271
|
+
@position += data.length
|
272
|
+
@naptime = 0
|
273
|
+
|
274
|
+
# Subclasses should implement receive_data
|
275
|
+
receive_data(data)
|
276
|
+
schedule_next_read
|
273
277
|
end # def read
|
274
278
|
|
275
279
|
# Do EOF handling on next EM iteration
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eventmachine-tail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 2
|
10
|
+
version: 0.6.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jordan Sissel
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-08-10 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -42,18 +42,17 @@ extensions: []
|
|
42
42
|
extra_rdoc_files: []
|
43
43
|
|
44
44
|
files:
|
45
|
-
- lib/eventmachine-tail.rb
|
46
45
|
- lib/em/filetail.rb
|
47
46
|
- lib/em/globwatcher.rb
|
48
|
-
-
|
47
|
+
- lib/eventmachine-tail.rb
|
49
48
|
- samples/glob-tail.rb
|
50
49
|
- samples/globwatch.rb
|
51
50
|
- samples/tail-with-block.rb
|
52
|
-
-
|
53
|
-
- test/logrotate.conf
|
54
|
-
- test/test_glob.rb
|
51
|
+
- samples/tail.rb
|
55
52
|
- test/alltests.rb
|
53
|
+
- test/test_glob.rb
|
56
54
|
- test/testcase_helpers.rb
|
55
|
+
- test/test_filetail.rb
|
57
56
|
- bin/rtail
|
58
57
|
- bin/emtail
|
59
58
|
has_rdoc: true
|
@@ -87,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
86
|
requirements: []
|
88
87
|
|
89
88
|
rubyforge_project:
|
90
|
-
rubygems_version: 1.
|
89
|
+
rubygems_version: 1.6.2
|
91
90
|
signing_key:
|
92
91
|
specification_version: 3
|
93
92
|
summary: eventmachine tail - a file tail implementation with glob support
|
data/test/logrotate.conf
DELETED