open4 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -10,6 +10,9 @@ SYNOPSIS
10
10
 
11
11
  HISTORY
12
12
 
13
+ 0.9.2:
14
+ - fixed a descriptor leak. thanks Andre Nathan.
15
+
13
16
  0.9.1:
14
17
  - fixed warning with '-w' : @cid not initialized. thanks blaise tarr.
15
18
 
data/leak.rb ADDED
@@ -0,0 +1,17 @@
1
+ require 'open4'
2
+
3
+ pid = Process.pid
4
+ fds = lambda{|pid| Dir["/proc/#{ pid }/fd/*"]}
5
+
6
+ loop do
7
+ before = fds[pid]
8
+ Open4.popen4 'ruby -e"buf = STDIN.read; STDOUT.puts buf; STDERR.puts buf "' do |p,i,o,e|
9
+ i.puts 42
10
+ i.close_write
11
+ o.read
12
+ e.read
13
+ end
14
+ after = fds[pid]
15
+ p(after - before)
16
+ puts
17
+ end
@@ -4,7 +4,7 @@ require 'thread'
4
4
 
5
5
  module Open4
6
6
  #--{{{
7
- VERSION = '0.9.1'
7
+ VERSION = '0.9.2'
8
8
  def self.version() VERSION end
9
9
 
10
10
  class Error < ::StandardError; end
@@ -13,6 +13,11 @@ module Open4
13
13
  #--{{{
14
14
  pw, pr, pe, ps = IO.pipe, IO.pipe, IO.pipe, IO.pipe
15
15
 
16
+ %w( pw pr pe ps ).each do |pair|
17
+ puts "#{ pair }.first.fileno: " => eval(pair).first.fileno
18
+ puts "#{ pair }.last.fileno: " => eval(pair).last.fileno
19
+ end
20
+
16
21
  verbose = $VERBOSE
17
22
  begin
18
23
  $VERBOSE = nil
@@ -54,6 +59,8 @@ module Open4
54
59
  raise(Exception === e ? e : "unknown failure!")
55
60
  rescue EOFError # If we get an EOF error, then the exec was successful
56
61
  42
62
+ ensure
63
+ ps.first.close
57
64
  end
58
65
 
59
66
  pw.last.sync = true
@@ -4,7 +4,7 @@ require 'thread'
4
4
 
5
5
  module Open4
6
6
  #--{{{
7
- VERSION = '0.9.1'
7
+ VERSION = '0.9.2'
8
8
  def self.version() VERSION end
9
9
 
10
10
  class Error < ::StandardError; end
@@ -13,6 +13,11 @@ module Open4
13
13
  #--{{{
14
14
  pw, pr, pe, ps = IO.pipe, IO.pipe, IO.pipe, IO.pipe
15
15
 
16
+ %w( pw pr pe ps ).each do |pair|
17
+ puts "#{ pair }.first.fileno: " => eval(pair).first.fileno
18
+ puts "#{ pair }.last.fileno: " => eval(pair).last.fileno
19
+ end
20
+
16
21
  verbose = $VERBOSE
17
22
  begin
18
23
  $VERBOSE = nil
@@ -54,6 +59,8 @@ module Open4
54
59
  raise(Exception === e ? e : "unknown failure!")
55
60
  rescue EOFError # If we get an EOF error, then the exec was successful
56
61
  42
62
+ ensure
63
+ ps.first.close
57
64
  end
58
65
 
59
66
  pw.last.sync = true
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.11
2
+ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: open4
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.9.1
7
- date: 2006-10-24 00:00:00.000000 -06:00
6
+ version: 0.9.2
7
+ date: 2007-03-25 00:00:00 -06:00
8
8
  summary: open4
9
9
  require_paths:
10
- - lib
10
+ - lib
11
11
  email: ara.t.howard@noaa.gov
12
12
  homepage: http://codeforpeople.com/lib/ruby/open4/
13
13
  rubyforge_project:
@@ -18,35 +18,43 @@ bindir: bin
18
18
  has_rdoc: false
19
19
  required_ruby_version: !ruby/object:Gem::Version::Requirement
20
20
  requirements:
21
- -
22
- - ">"
23
- - !ruby/object:Gem::Version
24
- version: 0.0.0
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
25
24
  version:
26
25
  platform: ruby
27
26
  signing_key:
28
27
  cert_chain:
28
+ post_install_message:
29
29
  authors:
30
- - Ara T. Howard
30
+ - Ara T. Howard
31
31
  files:
32
- - install.rb
33
- - sample
34
- - lib
35
- - README
36
- - gemspec.rb
37
- - sample/block.rb
38
- - sample/simple.rb
39
- - sample/exception.rb
40
- - sample/spawn.rb
41
- - sample/bg.rb
42
- - sample/timeout.rb
43
- - sample/stdin_timeout.rb
44
- - lib/open4.rb
45
- - lib/open4-0.9.1.rb
32
+ - install.rb
33
+ - sample
34
+ - sample/block.rb
35
+ - sample/simple.rb
36
+ - sample/exception.rb
37
+ - sample/spawn.rb
38
+ - sample/bg.rb
39
+ - sample/timeout.rb
40
+ - sample/stdin_timeout.rb
41
+ - lib
42
+ - lib/open4.rb
43
+ - lib/open4-0.9.2.rb
44
+ - README
45
+ - gemspec.rb
46
+ - leak.rb
46
47
  test_files: []
48
+
47
49
  rdoc_options: []
50
+
48
51
  extra_rdoc_files: []
52
+
49
53
  executables: []
54
+
50
55
  extensions: []
56
+
51
57
  requirements: []
52
- dependencies: []
58
+
59
+ dependencies: []
60
+