bixby-common 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1f5f1fb87533cdcdfaba7bd9ba0532d0c6c1aed0
4
- data.tar.gz: 1937a3c76c45d644396d17a9e75c6c1b38689686
3
+ metadata.gz: f917af6b0c09f9ac2c4b27040bf752ca4a83399f
4
+ data.tar.gz: 2d0e5e87a996acfa68e19cbe93e794cbc1ca4e8c
5
5
  SHA512:
6
- metadata.gz: 4208517467da1d40ee2c706a10ef794742d173fab1bfa669a9c48dcf94466e10d078c473d7bd0165c5516b3f0ba4d12307ddb0a0e35b2391ebb9edcdbeea1e13
7
- data.tar.gz: 54a5a6c786e43aede794bbd0d70aa7468aa729fd5451c4d560c4e06281d4db0616f4f887a612f40c97b067bca8c842e665433345c9e4196e0dfa3c5fc0fcd6ab
6
+ metadata.gz: 60bf34b93f1ba0c9a306b7c6c86e88bbb20c951a2147804194285faf74beb35c7f4f06d0dc34094a0774c424e5bab17068ac3bef274d9f153959d8b536fee1c6
7
+ data.tar.gz: 3287f8e98887ae22ff62bad20c2eda2f2bee8fd2b7fd53c855ba7aae06bbb071fd18d1adc2a6d47e72df59762ef6fc456e15b465b74de2aa349e2b6d230d33e3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.1
1
+ 0.6.2
data/bixby-common.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: bixby-common 0.6.1 ruby lib
5
+ # stub: bixby-common 0.6.2 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "bixby-common"
9
- s.version = "0.6.1"
9
+ s.version = "0.6.2"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Chetan Sarva"]
14
- s.date = "2015-01-23"
14
+ s.date = "2015-01-28"
15
15
  s.description = "Bixby Common files/libs"
16
16
  s.email = "chetan@pixelcop.net"
17
17
  s.extra_rdoc_files = [
@@ -12,14 +12,9 @@ module Bixby
12
12
  sigs = signals.flatten.map{ |s| s.split(/[\s,]/) }.flatten.sort.uniq
13
13
 
14
14
  trap_r, trap_w = IO.pipe
15
- sigs.each do |sig|
16
- Kernel.trap(sig) do
17
- trap_w.puts(sig)
18
- end
19
- end
20
15
 
21
16
  # handle signals from a dedicated thread
22
- Thread.new do
17
+ handler_thread = Thread.new do
23
18
  while true
24
19
  sig = trap_r.readline.strip
25
20
  Thread.new do
@@ -28,7 +23,17 @@ module Bixby
28
23
  end
29
24
  end
30
25
 
31
- end
26
+ sigs.each do |sig|
27
+ Kernel.trap(sig) do
28
+ if handler_thread && handler_thread.alive? then
29
+ # don't bother writing if the thread is dead
30
+ trap_w.puts(sig)
31
+ end
32
+ end
33
+ end
34
+
35
+ return handler_thread
36
+ end # trap
32
37
 
33
38
  end
34
39
  end
@@ -17,15 +17,23 @@ module Bixby
17
17
  # kill -ALRM <pid>
18
18
  #
19
19
  # You can cancel the signal trap by saving the returned Thread and killing it
20
+ # @param [IO] logger IO-like destination for thread dumps (responds to #puts)
20
21
  #
21
22
  # @return [Thread]
22
- def trap!
23
+ def trap!(logger=nil)
24
+
25
+ if logger.nil? then
26
+ logger = STDERR
27
+ elsif Module.const_defined?(:Logging) && logger.kind_of?(Logging::Logger) then
28
+ logger = LoggerIO.new(logger)
29
+ end
30
+
23
31
  t = Bixby::Signal.trap("SIGALRM") do
24
- write(LoggerIO.new(Logging.logger[ThreadDump]))
32
+ write(logger)
25
33
  end
26
34
  t[:_name] = "dumper [ignore me]"
27
35
 
28
- Logging.logger[ThreadDump].info "Trapping SIGALRM: kill -ALRM #{Process.pid}"
36
+ logger.puts("Trapping SIGALRM: kill -ALRM #{Process.pid}")
29
37
  return t
30
38
  end
31
39
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bixby-common
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chetan Sarva
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-23 00:00:00.000000000 Z
11
+ date: 2015-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bixby-auth