childprocess 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +18 -0
- data/VERSION +1 -1
- data/childprocess.gemspec +5 -3
- data/lib/childprocess.rb +2 -0
- data/lib/childprocess/unix/process.rb +3 -2
- data/spec/childprocess_spec.rb +1 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/unix_process_spec.rb +29 -0
- metadata +3 -1
data/Rakefile
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'rake'
|
3
|
+
require 'tmpdir'
|
3
4
|
|
4
5
|
begin
|
5
6
|
require 'jeweler'
|
@@ -46,3 +47,20 @@ rescue LoadError
|
|
46
47
|
abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
|
47
48
|
end
|
48
49
|
end
|
50
|
+
|
51
|
+
task :clean do
|
52
|
+
rm_rf "pkg"
|
53
|
+
rm_rf "childprocess.jar"
|
54
|
+
end
|
55
|
+
|
56
|
+
desc 'Create jar to bundle in selenium-webdriver'
|
57
|
+
task :jar => [:clean, :build] do
|
58
|
+
tmpdir = Dir.mktmpdir("childprocess-jar")
|
59
|
+
gem_to_package = Dir['pkg/*.gem'].first
|
60
|
+
gem_name = File.basename(gem_to_package, ".gem")
|
61
|
+
p :gem_to_package => gem_to_package, :gem_name => gem_name
|
62
|
+
|
63
|
+
sh "gem install -i #{tmpdir} #{gem_to_package} --ignore-dependencies --no-rdoc --no-ri"
|
64
|
+
sh "jar cf childprocess.jar -C #{tmpdir}/gems/#{gem_name}/lib ."
|
65
|
+
sh "jar tf childprocess.jar"
|
66
|
+
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
data/childprocess.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{childprocess}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jari Bakken"]
|
@@ -42,7 +42,8 @@ Gem::Specification.new do |s|
|
|
42
42
|
"lib/childprocess/windows/structs.rb",
|
43
43
|
"spec/childprocess_spec.rb",
|
44
44
|
"spec/spec.opts",
|
45
|
-
"spec/spec_helper.rb"
|
45
|
+
"spec/spec_helper.rb",
|
46
|
+
"spec/unix_process_spec.rb"
|
46
47
|
]
|
47
48
|
s.homepage = %q{http://github.com/jarib/childprocess}
|
48
49
|
s.rdoc_options = ["--charset=UTF-8"]
|
@@ -51,7 +52,8 @@ Gem::Specification.new do |s|
|
|
51
52
|
s.summary = %q{Cross-platform ruby library for managing child processes.}
|
52
53
|
s.test_files = [
|
53
54
|
"spec/childprocess_spec.rb",
|
54
|
-
"spec/spec_helper.rb"
|
55
|
+
"spec/spec_helper.rb",
|
56
|
+
"spec/unix_process_spec.rb"
|
55
57
|
]
|
56
58
|
|
57
59
|
if s.respond_to? :specification_version then
|
data/lib/childprocess.rb
CHANGED
data/spec/childprocess_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -0,0 +1,29 @@
|
|
1
|
+
shared_examples_for "unix process" do
|
2
|
+
it "handles ECHILD race condition where process dies between timeout and KILL" do
|
3
|
+
process = sleeping_ruby
|
4
|
+
|
5
|
+
process.stub!(:fork).and_return('fakepid')
|
6
|
+
process.stub!(:send_term)
|
7
|
+
process.stub!(:poll_for_exit).and_raise(ChildProcess::TimeoutError)
|
8
|
+
process.stub!(:send_kill).and_raise(Errno::ECHILD)
|
9
|
+
|
10
|
+
process.start
|
11
|
+
lambda { process.stop }.should_not raise_error
|
12
|
+
|
13
|
+
process.stub(:alive?).and_return(false)
|
14
|
+
end
|
15
|
+
|
16
|
+
it "handles ESRCH race condition where process dies between timeout and KILL" do
|
17
|
+
process = sleeping_ruby
|
18
|
+
|
19
|
+
process.stub!(:fork).and_return('fakepid')
|
20
|
+
process.stub!(:send_term)
|
21
|
+
process.stub!(:poll_for_exit).and_raise(ChildProcess::TimeoutError)
|
22
|
+
process.stub!(:send_kill).and_raise(Errno::ESRCH)
|
23
|
+
|
24
|
+
process.start
|
25
|
+
lambda { process.stop }.should_not raise_error
|
26
|
+
|
27
|
+
process.stub(:alive?).and_return(false)
|
28
|
+
end
|
29
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: childprocess
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jari Bakken
|
@@ -78,6 +78,7 @@ files:
|
|
78
78
|
- spec/childprocess_spec.rb
|
79
79
|
- spec/spec.opts
|
80
80
|
- spec/spec_helper.rb
|
81
|
+
- spec/unix_process_spec.rb
|
81
82
|
has_rdoc: true
|
82
83
|
homepage: http://github.com/jarib/childprocess
|
83
84
|
licenses: []
|
@@ -109,3 +110,4 @@ summary: Cross-platform ruby library for managing child processes.
|
|
109
110
|
test_files:
|
110
111
|
- spec/childprocess_spec.rb
|
111
112
|
- spec/spec_helper.rb
|
113
|
+
- spec/unix_process_spec.rb
|