scout-essentials 1.8.1 → 1.8.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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/scout/cmd.rb +10 -7
- data/lib/scout/concurrent_stream.rb +3 -1
- data/scout-essentials.gemspec +2 -2
- data/test/scout/test_cmd.rb +14 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 47e74859c0d59a6223fa7712841dedd25fab88e64fa106f56de75aacb53482a2
|
|
4
|
+
data.tar.gz: d3a60f92ef5ded228cee841b94e75c41a2bb4c2ab2c31c7326d183adaf8c9004
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c9f6625a056a04da4759694239eb61fd0c4c198a023ddaad66efe3748322f844cc206cea6a1d10f4fb992b36a997a223c8b20d902d14a1bc9c74cfcdca1bc7d9
|
|
7
|
+
data.tar.gz: a55d298f3b81c5966e28a1785270b29ba29581c1e004135810c01648bc51c02b32e1d2588e92d8e26513acd1a860860064e474d62c21a3633f5f3908f14202f7
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.8.
|
|
1
|
+
1.8.2
|
data/lib/scout/cmd.rb
CHANGED
|
@@ -202,8 +202,11 @@ module CMD
|
|
|
202
202
|
Thread.current["name"] = "CMD in"
|
|
203
203
|
while c = in_content.read(Open::BLOCK_SIZE)
|
|
204
204
|
sin << c
|
|
205
|
+
break if in_content.closed?
|
|
205
206
|
end
|
|
207
|
+
|
|
206
208
|
sin.close unless sin.closed?
|
|
209
|
+
sin.join if sin.respond_to? :join
|
|
207
210
|
|
|
208
211
|
unless dont_close_in
|
|
209
212
|
in_content.close unless in_content.closed?
|
|
@@ -232,13 +235,13 @@ module CMD
|
|
|
232
235
|
err_thread = Thread.new do
|
|
233
236
|
Thread.current["name"] = "Error log: [#{pid}] #{ cmd }"
|
|
234
237
|
begin
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
238
|
+
while line = serr.gets
|
|
239
|
+
bar.process(line) if bar
|
|
240
|
+
sout.log = line
|
|
241
|
+
sout.std_err << line if save_stderr
|
|
242
|
+
Log.log "STDERR [#{pid}]: " + line, stderr if log
|
|
243
|
+
end
|
|
244
|
+
serr.close
|
|
242
245
|
rescue
|
|
243
246
|
Log.exception $!
|
|
244
247
|
raise $!
|
|
@@ -12,7 +12,9 @@ module ConcurrentStream
|
|
|
12
12
|
attr_accessor :threads, :pids, :callback, :abort_callback, :filename, :joined, :aborted, :autojoin, :lock, :no_fail, :pair, :thread, :stream_exception, :log, :std_err, :next, :exit_status
|
|
13
13
|
|
|
14
14
|
def self.setup(stream, options = {}, &block)
|
|
15
|
-
threads, pids, callback, abort_callback, filename, autojoin, lock, no_fail, pair, next_stream = IndiferentHash.process_options options,
|
|
15
|
+
threads, pids, callback, abort_callback, filename, autojoin, lock, no_fail, pair, next_stream = IndiferentHash.process_options options,
|
|
16
|
+
:threads, :pids, :callback, :abort_callback, :filename, :autojoin, :lock, :no_fail, :pair, :next
|
|
17
|
+
|
|
16
18
|
stream.extend ConcurrentStream unless ConcurrentStream === stream
|
|
17
19
|
|
|
18
20
|
stream.threads ||= []
|
data/scout-essentials.gemspec
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
|
5
|
-
# stub: scout-essentials 1.8.
|
|
5
|
+
# stub: scout-essentials 1.8.2 ruby lib
|
|
6
6
|
|
|
7
7
|
Gem::Specification.new do |s|
|
|
8
8
|
s.name = "scout-essentials".freeze
|
|
9
|
-
s.version = "1.8.
|
|
9
|
+
s.version = "1.8.2".freeze
|
|
10
10
|
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
|
12
12
|
s.require_paths = ["lib".freeze]
|
data/test/scout/test_cmd.rb
CHANGED
|
@@ -29,6 +29,20 @@ class TestCmd < Test::Unit::TestCase
|
|
|
29
29
|
assert_equal("test2\n", CMD.cmd("cut", "-f" => 2, "-d" => ' ', :in => "test1 test2", :pipe => true).read)
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
+
def test_in_io
|
|
33
|
+
text =<<-EOF
|
|
34
|
+
line1
|
|
35
|
+
line2
|
|
36
|
+
line3
|
|
37
|
+
line4
|
|
38
|
+
EOF
|
|
39
|
+
TmpFile.with_file(text) do |file|
|
|
40
|
+
io = Open.open(file)
|
|
41
|
+
ConcurrentStream.setup(io)
|
|
42
|
+
CMD.cmd('wc -l', in: io)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
32
46
|
def test_error
|
|
33
47
|
Log.with_severity 6 do
|
|
34
48
|
assert_raise ProcessFailed do CMD.cmd('fake-command') end
|