open4 1.3.3 → 1.3.4

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YTM2ZTNmNzUxMDkwZWM4YzQ2NjdhOGU5MjdjOGRhY2Y1ODIyMzhkYg==
4
+ ZTUyNzE3MzczYmM1N2M5ZTQ0MWY0ZTkxMGM2NDcwODQzZWU3YjBkZg==
5
5
  data.tar.gz: !binary |-
6
- ZTM2NTNmMDEyZWFkMTA2MDM3OTE4YmZjOWE3ZmFiNDE0MGI2OTVkOA==
6
+ NDU2NWRlNGIxZjg5OGZmYjA5OGZhNDhhMTBiZDI2NTEyYzgxMTc5ZQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MTY0ZDVjOTMyNjU4ZjMwZjIxOGNiNGEzYzQ2MjRjMGRmZDgyYjU1NGIwNTc0
10
- MDkwMjU2NjRiYzc4ZjMyOTA3NjAyMmQ5ZjJkYTgzMGQwYWIyZDk1ODBkM2Zj
11
- MzUzYjIxYzg5ODdlYzFmMWJiNTc3NjljZWI3ZmNhNzJhNzM5ODI=
9
+ ZDJjMzYwZjA5OGY5ODI2MDA3YzY5MmVkZjNjYjYzYTQyMjIzNmRjNzk3NDZi
10
+ NjRiMDExNjZjZDBkMWM5MWY0ZTlmNTYxNDRlODQ5NTNjMjk3YzcyNTYzYzU0
11
+ ZGIxYTNiZjc0MjdkY2JkZmNkYWIxYWY1MDlmY2RmYTdmZTUyZDk=
12
12
  data.tar.gz: !binary |-
13
- YWJhZDFkNDUwYTczNDgzOGU1ZjEyMGMwZjg5MDMwOThhYWM5Yjg2NmUwYTkw
14
- ZTdlYjc4ZjRhYzM2MjQ5MDBhNDYxZTkzMjgzYzRjZWI3ZjM1MjIxNGQ5OTFl
15
- NzNhNjY5NmQzNDczMTg0NzI3YzFmNTg4MmJhNjhkODZjOTI3YzQ=
13
+ MzkxZDc2ODhjMjk4ZDEwMzM0YjIxYzEyYThiYTg3YmRlOTljYmRiOGUzMGY2
14
+ NTU0NmM4OTg2OTRlNDYwODMzMmU5ODA5OTkzNmYzMTgxYmIzY2ZlNGQ1NzE4
15
+ ZmY3ZDNlZmRmYzRiYmE2MGM0MDgxYjJhYWZkZTZhM2Q4ZmIyMzM=
@@ -4,7 +4,7 @@ require 'timeout'
4
4
  require 'thread'
5
5
 
6
6
  module Open4
7
- VERSION = '1.3.3'
7
+ VERSION = '1.3.4'
8
8
  def Open4.version() VERSION end
9
9
 
10
10
  def Open4.description
@@ -183,9 +183,9 @@ module Open4
183
183
 
184
184
  begin
185
185
  @argv.each do |a, b|
186
- @threads << Thread.new(*a) do |*a|
186
+ @threads << Thread.new(*a) do |*_a|
187
187
  begin
188
- b[*a]
188
+ b[*_a]
189
189
  ensure
190
190
  killall rescue nil if $!
191
191
  @done.push Thread.current
@@ -214,9 +214,9 @@ module Open4
214
214
 
215
215
  def new_thread *a, &b
216
216
  cur = Thread.current
217
- Thread.new(*a) do |*a|
217
+ Thread.new(*a) do |*_a|
218
218
  begin
219
- b[*a]
219
+ b[*_a]
220
220
  rescue Exception => e
221
221
  cur.raise e
222
222
  end
@@ -229,8 +229,8 @@ module Open4
229
229
  keys, default, _ = args
230
230
  catch(:opt) do
231
231
  [keys].flatten.each do |key|
232
- [key, key.to_s, key.to_s.intern].each do |key|
233
- throw :opt, opts[key] if opts.has_key?(key)
232
+ [key, key.to_s, key.to_s.intern].each do |_key|
233
+ throw :opt, opts[_key] if opts.has_key?(_key)
234
234
  end
235
235
  end
236
236
  default
@@ -259,19 +259,19 @@ module Open4
259
259
  q = Queue.new
260
260
  th = nil
261
261
 
262
- timer_set = lambda do |t|
263
- th = new_thread{ to(t){ q.pop } }
262
+ timer_set = lambda do |_t|
263
+ th = new_thread{ to(_t){ q.pop } }
264
264
  end
265
265
 
266
- timer_cancel = lambda do |t|
266
+ timer_cancel = lambda do |_t|
267
267
  th.kill if th rescue nil
268
268
  end
269
269
 
270
270
  timer_set[t]
271
271
  begin
272
- src.each do |buf|
272
+ src.each do |_buf|
273
273
  timer_cancel[t]
274
- send_dst[buf]
274
+ send_dst[_buf]
275
275
  timer_set[t]
276
276
  end
277
277
  ensure
@@ -342,17 +342,17 @@ module Open4
342
342
 
343
343
  te = ThreadEnsemble.new c
344
344
 
345
- te.add_thread(i, stdin) do |i, stdin|
346
- relay stdin, i, stdin_timeout
347
- i.close rescue nil
345
+ te.add_thread(i, stdin) do |_i, _stdin|
346
+ relay _stdin, _i, stdin_timeout
347
+ _i.close rescue nil
348
348
  end
349
349
 
350
- te.add_thread(o, stdout) do |o, stdout|
351
- relay o, stdout, stdout_timeout
350
+ te.add_thread(o, stdout) do |_o, _stdout|
351
+ relay _o, _stdout, stdout_timeout
352
352
  end
353
353
 
354
- te.add_thread(e, stderr) do |o, stderr|
355
- relay e, stderr, stderr_timeout
354
+ te.add_thread(e, stderr) do |_o, _stderr| # HACK: I think this is a bug
355
+ relay e, _stderr, stderr_timeout
356
356
  end
357
357
 
358
358
  te.run
@@ -386,7 +386,7 @@ module Open4
386
386
  else
387
387
  argv.push opts
388
388
  end
389
- thread = Thread.new(arg, argv){|arg, argv| spawn arg, *argv}
389
+ thread = Thread.new(arg, argv){|_arg, _argv| spawn _arg, *_argv}
390
390
  sc = class << thread; self; end
391
391
  sc.module_eval {
392
392
  define_method(:pid){ @pid ||= q.pop }
@@ -3,7 +3,7 @@
3
3
 
4
4
  Gem::Specification::new do |spec|
5
5
  spec.name = "open4"
6
- spec.version = "1.3.3"
6
+ spec.version = "1.3.4"
7
7
  spec.platform = Gem::Platform::RUBY
8
8
  spec.summary = "open4"
9
9
  spec.description = "open child process with handles on pid, stdin, stdout, and stderr: manage child processes and their io handles easily."
@@ -28,11 +28,11 @@ Gem::Specification::new do |spec|
28
28
  "samples/stdin_timeout.rb",
29
29
  "samples/timeout.rb",
30
30
  "test",
31
+ "test/lib",
32
+ "test/lib/test_case.rb",
31
33
  "test/pfork4_test.rb",
32
34
  "test/popen4_test.rb",
33
35
  "test/popen4ext_test.rb",
34
- "test/support",
35
- "test/support/test_case.rb",
36
36
  "white_box",
37
37
  "white_box/leak.rb"]
38
38
 
data/rakefile CHANGED
@@ -32,7 +32,7 @@ def run_tests!(which = nil)
32
32
 
33
33
  test_rbs.each_with_index do |test_rb, index|
34
34
  testno = index + 1
35
- command = "#{ This.ruby } -w -I ./lib -I ./test/lib #{ test_rb }"
35
+ command = "#{ This.ruby } -rubygems -w -I ./lib -I ./test/lib #{ test_rb }"
36
36
 
37
37
  puts
38
38
  say(div, :color => :cyan, :bold => true)
@@ -13,7 +13,7 @@ module Open4
13
13
  class MyError < RuntimeError; end
14
14
 
15
15
  def on_mri?
16
- ::Config::CONFIG['ruby_install_name'] == 'ruby'
16
+ ::RbConfig::CONFIG['ruby_install_name'] == 'ruby'
17
17
  end
18
18
 
19
19
  def wait_status(cid)
@@ -51,7 +51,7 @@ class PFork4Test < TestCase
51
51
  fun = lambda { $stdout.write Process.pid }
52
52
  cid_in_block = nil
53
53
  cid_in_fun = nil
54
- status = pfork4(fun) do |cid, _, stdout, _|
54
+ pfork4(fun) do |cid, _, stdout, _|
55
55
  cid_in_block = cid
56
56
  cid_in_fun = stdout.read.to_i
57
57
  end
@@ -8,7 +8,7 @@ class POpen4Test < TestCase
8
8
 
9
9
  def test_unknown_command_propagates_exception
10
10
  err = assert_raises(*UNKNOWN_CMD_ERRORS) { popen4 UNKNOWN_CMD }
11
- assert_match /#{UNKNOWN_CMD}/, err.to_s if on_mri?
11
+ assert_match(/#{UNKNOWN_CMD}/, err.to_s) if on_mri?
12
12
  end
13
13
 
14
14
  def test_exception_propagation_avoids_zombie_child_process
@@ -31,7 +31,7 @@ class POpen4Test < TestCase
31
31
  cmd = %{ruby -e "STDOUT.print Process.pid"}
32
32
  cid_in_block = nil
33
33
  cid_in_fun = nil
34
- status = popen4(cmd) do |cid, _, stdout, _|
34
+ popen4(cmd) do |cid, _, stdout, _|
35
35
  cid_in_block = cid
36
36
  cid_in_fun = stdout.read.to_i
37
37
  end
@@ -9,7 +9,7 @@ class POpen4Test < TestCase
9
9
 
10
10
  def test_unknown_command_propagates_exception
11
11
  err = assert_raises(*UNKNOWN_CMD_ERRORS) { popen4ext true, UNKNOWN_CMD }
12
- assert_match /#{UNKNOWN_CMD}/, err.to_s if on_mri?
12
+ assert_match(/#{UNKNOWN_CMD}/, err.to_s) if on_mri?
13
13
  end
14
14
 
15
15
  def test_exception_propagation_avoids_zombie_child_process
@@ -32,7 +32,7 @@ class POpen4Test < TestCase
32
32
  cmd = %{ruby -e "STDOUT.print Process.pid"}
33
33
  cid_in_block = nil
34
34
  cid_in_fun = nil
35
- status = popen4ext(true, cmd) do |cid, _, stdout, _|
35
+ popen4ext(true, cmd) do |cid, _, stdout, _|
36
36
  cid_in_block = cid
37
37
  cid_in_fun = stdout.read.to_i
38
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: open4
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ version: 1.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ara T. Howard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-03 00:00:00.000000000 Z
11
+ date: 2014-05-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: ! 'open child process with handles on pid, stdin, stdout, and stderr:
14
14
  manage child processes and their io handles easily.'
@@ -32,10 +32,10 @@ files:
32
32
  - samples/spawn.rb
33
33
  - samples/stdin_timeout.rb
34
34
  - samples/timeout.rb
35
+ - test/lib/test_case.rb
35
36
  - test/pfork4_test.rb
36
37
  - test/popen4_test.rb
37
38
  - test/popen4ext_test.rb
38
- - test/support/test_case.rb
39
39
  - white_box/leak.rb
40
40
  homepage: https://github.com/ahoward/open4
41
41
  licenses: