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 +3 -0
- data/leak.rb +17 -0
- data/lib/{open4-0.9.1.rb → open4-0.9.2.rb} +8 -1
- data/lib/open4.rb +8 -1
- metadata +32 -24
data/README
CHANGED
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.
|
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
|
data/lib/open4.rb
CHANGED
@@ -4,7 +4,7 @@ require 'thread'
|
|
4
4
|
|
5
5
|
module Open4
|
6
6
|
#--{{{
|
7
|
-
VERSION = '0.9.
|
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.
|
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.
|
7
|
-
date:
|
6
|
+
version: 0.9.2
|
7
|
+
date: 2007-03-25 00:00:00 -06:00
|
8
8
|
summary: open4
|
9
9
|
require_paths:
|
10
|
-
|
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
|
-
|
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
|
-
|
30
|
+
- Ara T. Howard
|
31
31
|
files:
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
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
|
-
|
58
|
+
|
59
|
+
dependencies: []
|
60
|
+
|