sensu-spawn 1.3.0 → 1.4.0
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/CHANGELOG.md +8 -0
- data/lib/sensu/spawn.rb +9 -1
- data/sensu-spawn.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1801d4320cdbd3204d53c55be6ca9e9015e3add6
|
4
|
+
data.tar.gz: 0b43c57912c8b1312a1aecf6a4d68de67517a459
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59f4e684cdb4003ed7c560a0467c584176ecd97c343bb038701b08103476fd574d6aea97864d3bf5e860aee05340f4733c62c8472a87f319b2cfb6472814a15b
|
7
|
+
data.tar.gz: dce51d92a0f2a5c31ec031a0f5369e15357347d4cede3799d8bd7a4cd0f9b134f7bd632c445d9afb3a35bf062b54f132141584b66210df6f3727241ebd0e45e6
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## 1.4.0 - 2015-09-09
|
2
|
+
|
3
|
+
### Fixes
|
4
|
+
|
5
|
+
Added a mutex `synchronize()` around ChildProcess Unix POSIX spawn
|
6
|
+
(`start()`), as it is not thread safe, allowing safe execution on
|
7
|
+
Ruby runtimes with real threads (JRuby).
|
8
|
+
|
1
9
|
## 1.3.0 - 2015-07-09
|
2
10
|
|
3
11
|
### Other
|
data/lib/sensu/spawn.rb
CHANGED
@@ -5,6 +5,7 @@ gem "childprocess", "0.5.6"
|
|
5
5
|
require "eventmachine"
|
6
6
|
require "em/worker"
|
7
7
|
require "childprocess"
|
8
|
+
require "rbconfig"
|
8
9
|
require "ffi"
|
9
10
|
|
10
11
|
begin
|
@@ -15,6 +16,8 @@ rescue LoadError; end
|
|
15
16
|
|
16
17
|
module Sensu
|
17
18
|
module Spawn
|
19
|
+
@@mutex = Mutex.new
|
20
|
+
|
18
21
|
class << self
|
19
22
|
# Spawn a child process. A maximum of 12 processes will be
|
20
23
|
# spawned at a time. The EventMachine reactor (loop) must be
|
@@ -74,6 +77,9 @@ module Sensu
|
|
74
77
|
# Create a child process, return its output (STDERR & STDOUT),
|
75
78
|
# and exit status. The child process will have its own process
|
76
79
|
# group, may accept data via STDIN, and have a timeout.
|
80
|
+
# ChildProcess Unix POSIX spawn (`start()`) is not thread safe,
|
81
|
+
# so a mutex is used to allow safe execution on Ruby runtimes
|
82
|
+
# with real threads (JRuby).
|
77
83
|
#
|
78
84
|
# The child process timeout functionality needs to be re-worked,
|
79
85
|
# as it currenty allows for a deadlock, when the child output is
|
@@ -87,7 +93,9 @@ module Sensu
|
|
87
93
|
def child_process(command, options={})
|
88
94
|
child, reader, writer = build_child_process(command)
|
89
95
|
child.duplex = true if options[:data]
|
90
|
-
|
96
|
+
@@mutex.synchronize do
|
97
|
+
child.start
|
98
|
+
end
|
91
99
|
writer.close
|
92
100
|
if options[:data]
|
93
101
|
child.io.stdin.write(options[:data])
|
data/sensu-spawn.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-spawn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Porter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-em
|