eventmachine-tail 0.2.20100524185851 → 0.2.20100525165012

Sign up to get free protection for your applications and to get access to all the features.
data/bin/rtail CHANGED
@@ -63,6 +63,13 @@ def main(args)
63
63
  end
64
64
 
65
65
  EventMachine.run do
66
+ Signal.trap("INT") do
67
+ EventMachine.schedule do
68
+ $stderr.puts "Got SIGINT"
69
+ exit 128 + (Signal.list["INT"])
70
+ end
71
+ end
72
+
66
73
  args.each do |path|
67
74
  EventMachine::FileGlobWatchTail.new(path, Reader,
68
75
  interval = globcheck_interval,
@@ -1,8 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
  #
3
- # Simple 'tail -f' example.
3
+ # Simple 'tail -f' example. This one uses a block instead of a separate handler
4
+ # class
4
5
  # Usage example:
5
- # tail.rb /var/log/messages
6
+ # tail-with-block.rb /var/log/messages
6
7
 
7
8
  require "rubygems"
8
9
  require "eventmachine"
@@ -17,6 +18,9 @@ def main(args)
17
18
  EventMachine.run do
18
19
  args.each do |path|
19
20
  EventMachine::file_tail(path) do |filetail, line|
21
+ # filetail is the 'EventMachine::FileTail' instance for this file.
22
+ # line is the line read from thefile.
23
+ # this block is invoked for every line read.
20
24
  puts line
21
25
  end
22
26
  end
data/test/test_glob.rb CHANGED
@@ -34,7 +34,7 @@ end # class Reader
34
34
 
35
35
  class TestGlobWatcher < Test::Unit::TestCase
36
36
  include EventMachineTailTestHelpers
37
- SLEEPMAX = 2
37
+ SLEEPMAX = 1
38
38
 
39
39
  def setup
40
40
  @watchinterval = 0.2
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 20100524185851
9
- version: 0.2.20100524185851
8
+ - 20100525165012
9
+ version: 0.2.20100525165012
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jordan Sissel
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-24 00:00:00 -07:00
17
+ date: 2010-05-25 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency