open4 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ Mjg2OTllN2JkYWYxOTI3NzJkMTA5ZTA0MWEwMTdmOTU2M2U4Zjk0Nw==
5
+ data.tar.gz: !binary |-
6
+ ODllZjAxNTM3MzYwOGQwMTgyOGEzNTdmZGE3N2ZmMTU0ZTYxZWRlNg==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ NDc5MTFjNjFiNGNlNjQzZjMxYTY5NWNkNjRiMzgzNjQ4MjQ5NmFiYzdjYWQ0
10
+ NmRjMWFmMTQ1YTk5NjI4ZTJhOTJiNGI4MGVjNTkxMzU1YzYyMDgyNDVjMTIw
11
+ YjE3NGZlN2JjYjk1ZTNmZWIwYWU5NTdhMTU0NzdkYTc0MDIyNTY=
12
+ data.tar.gz: !binary |-
13
+ ODAyYWRiNmIyZjY0ZTQ2NzBkYjZmYTFhMjY1MzY0ZTI3NTU5YTk4ODI1Zjhh
14
+ MDkzMzY0ZTlkNGZmNmUxOWQ1ZjA5OGMyYTgxYjVhNWQ3ZTg3Yzk3ODljZmQz
15
+ NzY2M2M2ZWM1NTY4NTVhYzc4ZmVhYzZiM2ViODg0Zjk4ZjdkNGE=
@@ -4,8 +4,12 @@ require 'timeout'
4
4
  require 'thread'
5
5
 
6
6
  module Open4
7
- VERSION = '1.3.0'
8
- def self.version() VERSION end
7
+ VERSION = '1.3.1'
8
+ def Open4.version() VERSION end
9
+
10
+ def Open4.description
11
+ 'open child process with handles on pid, stdin, stdout, and stderr: manage child processes and their io handles easily.'
12
+ end
9
13
 
10
14
  class Error < ::StandardError; end
11
15
 
@@ -59,7 +63,7 @@ module Open4
59
63
  if closefds
60
64
  exlist = [0, 1, 2] | [pw,pr,pe,ps].map{|p| [p.first.fileno, p.last.fileno] }.flatten
61
65
  ObjectSpace.each_object(IO){|io|
62
- io.close if (not io.closed?) and (not exlist.include? io.fileno)
66
+ io.close if (not io.closed?) and (not exlist.include? io.fileno) rescue nil
63
67
  }
64
68
  end
65
69
 
@@ -308,6 +312,7 @@ module Open4
308
312
  stderr_timeout = getopt[ %w( stderr_timeout ) ]
309
313
  status = getopt[ %w( status ) ]
310
314
  cwd = getopt[ %w( cwd dir ) ]
315
+ closefds = getopt[ %w( close_fds ) ]
311
316
 
312
317
  exitstatus =
313
318
  case exitstatus
@@ -328,7 +333,7 @@ module Open4
328
333
  begin
329
334
  chdir(cwd) do
330
335
  Timeout::timeout(timeout) do
331
- popen4(*argv) do |c, i, o, e|
336
+ popen4ext(closefds, *argv) do |c, i, o, e|
332
337
  started = true
333
338
 
334
339
  %w( replace pid= << push update ).each do |msg|
@@ -3,10 +3,11 @@
3
3
 
4
4
  Gem::Specification::new do |spec|
5
5
  spec.name = "open4"
6
- spec.version = "1.3.0"
6
+ spec.version = "1.3.1"
7
7
  spec.platform = Gem::Platform::RUBY
8
8
  spec.summary = "open4"
9
- spec.description = "description: open4 kicks the ass"
9
+ spec.description = "open child process with handles on pid, stdin, stdout, and stderr: manage child processes and their io handles easily."
10
+ spec.license = "same as ruby's"
10
11
 
11
12
  spec.files =
12
13
  ["LICENSE",
data/rakefile CHANGED
@@ -3,14 +3,28 @@ This.author = "Ara T. Howard"
3
3
  This.email = "ara.t.howard@gmail.com"
4
4
  This.homepage = "https://github.com/ahoward/#{ This.lib }"
5
5
 
6
+ task :license do
7
+ open('LICENSE', 'w'){|fd| fd.puts "same as ruby's"}
8
+ end
6
9
 
7
10
  task :default do
8
11
  puts((Rake::Task.tasks.map{|task| task.name.gsub(/::/,':')} - ['default']).sort)
9
12
  end
10
13
 
11
14
  task :test do
15
+ run_tests!
16
+ end
17
+
18
+ namespace :test do
19
+ task(:unit){ run_tests!(:unit) }
20
+ task(:functional){ run_tests!(:functional) }
21
+ task(:integration){ run_tests!(:integration) }
22
+ end
23
+
24
+ def run_tests!(which = nil)
25
+ which ||= '**'
12
26
  test_dir = File.join(This.dir, "test")
13
- test_glob ||= File.join(test_dir, "/**_test.rb")
27
+ test_glob ||= File.join(test_dir, "#{ which }/**_test.rb")
14
28
  test_rbs = Dir.glob(test_glob).sort
15
29
 
16
30
  div = ('=' * 119)
@@ -18,7 +32,7 @@ task :test do
18
32
 
19
33
  test_rbs.each_with_index do |test_rb, index|
20
34
  testno = index + 1
21
- command = "#{ This.ruby } -rubygems -I ./lib -I ./test/support #{ test_rb }"
35
+ command = "#{ This.ruby } -w -I ./lib -I ./test/lib #{ test_rb }"
22
36
 
23
37
  puts
24
38
  say(div, :color => :cyan, :bold => true)
@@ -79,6 +93,7 @@ task :gemspec do
79
93
  test_files = "test/#{ lib }.rb" if File.file?("test/#{ lib }.rb")
80
94
  summary = object.respond_to?(:summary) ? object.summary : "summary: #{ lib } kicks the ass"
81
95
  description = object.respond_to?(:description) ? object.description : "description: #{ lib } kicks the ass"
96
+ license = object.respond_to?(:license) ? object.license : "same as ruby's"
82
97
 
83
98
  if This.extensions.nil?
84
99
  This.extensions = []
@@ -104,6 +119,7 @@ task :gemspec do
104
119
  spec.platform = Gem::Platform::RUBY
105
120
  spec.summary = #{ lib.inspect }
106
121
  spec.description = #{ description.inspect }
122
+ spec.license = #{ license.inspect }
107
123
 
108
124
  spec.files =\n#{ files.sort.pretty_inspect }
109
125
  spec.executables = #{ executables.inspect }
@@ -164,8 +180,8 @@ task :readme do
164
180
  end
165
181
 
166
182
  template =
167
- if test(?e, 'readme.erb')
168
- Template{ IO.read('readme.erb') }
183
+ if test(?e, 'README.erb')
184
+ Template{ IO.read('README.erb') }
169
185
  else
170
186
  Template {
171
187
  <<-__
@@ -1,4 +1,5 @@
1
1
  require 'test_case'
2
+ require 'socket'
2
3
 
3
4
  module Open4
4
5
 
@@ -77,6 +78,12 @@ ruby -e "
77
78
  assert_equal err_msg, err_actual
78
79
  assert_equal 0, status.exitstatus
79
80
  end
81
+
82
+ def test_close_ignores_errors
83
+ TCPSocket.new('localhost', 59367).close rescue nil
84
+ cid, _ = popen4ext true, %{ruby -e "exit"}
85
+ assert_equal 0, wait_status(cid)
86
+ end
80
87
  end
81
88
 
82
89
  end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: open4
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
5
- prerelease:
4
+ version: 1.3.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Ara T. Howard
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2011-11-19 00:00:00.000000000 Z
11
+ date: 2014-02-15 00:00:00.000000000 Z
13
12
  dependencies: []
14
- description: ! 'description: open4 kicks the ass'
13
+ description: ! 'open child process with handles on pid, stdin, stdout, and stderr:
14
+ manage child processes and their io handles easily.'
15
15
  email: ara.t.howard@gmail.com
16
16
  executables: []
17
17
  extensions: []
@@ -38,27 +38,27 @@ files:
38
38
  - test/support/test_case.rb
39
39
  - white_box/leak.rb
40
40
  homepage: https://github.com/ahoward/open4
41
- licenses: []
41
+ licenses:
42
+ - same as ruby's
43
+ metadata: {}
42
44
  post_install_message:
43
45
  rdoc_options: []
44
46
  require_paths:
45
47
  - lib
46
48
  required_ruby_version: !ruby/object:Gem::Requirement
47
- none: false
48
49
  requirements:
49
50
  - - ! '>='
50
51
  - !ruby/object:Gem::Version
51
52
  version: '0'
52
53
  required_rubygems_version: !ruby/object:Gem::Requirement
53
- none: false
54
54
  requirements:
55
55
  - - ! '>='
56
56
  - !ruby/object:Gem::Version
57
57
  version: '0'
58
58
  requirements: []
59
59
  rubyforge_project: codeforpeople
60
- rubygems_version: 1.8.11
60
+ rubygems_version: 2.0.3
61
61
  signing_key:
62
- specification_version: 3
62
+ specification_version: 4
63
63
  summary: open4
64
64
  test_files: []