childprocess 0.9.0 → 3.0.0

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.
Files changed (50) hide show
  1. checksums.yaml +5 -5
  2. data/.document +6 -6
  3. data/.gitignore +28 -28
  4. data/.rspec +1 -1
  5. data/.travis.yml +40 -44
  6. data/CHANGELOG.md +73 -49
  7. data/Gemfile +21 -15
  8. data/LICENSE +20 -20
  9. data/README.md +218 -196
  10. data/Rakefile +61 -61
  11. data/appveyor.yml +42 -60
  12. data/childprocess.gemspec +26 -30
  13. data/lib/childprocess.rb +210 -205
  14. data/lib/childprocess/abstract_io.rb +36 -36
  15. data/lib/childprocess/abstract_process.rb +192 -192
  16. data/lib/childprocess/errors.rb +37 -26
  17. data/lib/childprocess/jruby.rb +56 -56
  18. data/lib/childprocess/jruby/io.rb +16 -16
  19. data/lib/childprocess/jruby/process.rb +184 -159
  20. data/lib/childprocess/jruby/pump.rb +53 -53
  21. data/lib/childprocess/tools/generator.rb +145 -145
  22. data/lib/childprocess/unix.rb +9 -9
  23. data/lib/childprocess/unix/fork_exec_process.rb +78 -70
  24. data/lib/childprocess/unix/io.rb +21 -21
  25. data/lib/childprocess/unix/lib.rb +186 -186
  26. data/lib/childprocess/unix/platform/i386-linux.rb +12 -12
  27. data/lib/childprocess/unix/platform/i386-solaris.rb +11 -11
  28. data/lib/childprocess/unix/platform/x86_64-linux.rb +12 -12
  29. data/lib/childprocess/unix/platform/x86_64-macosx.rb +11 -11
  30. data/lib/childprocess/unix/posix_spawn_process.rb +134 -134
  31. data/lib/childprocess/unix/process.rb +90 -89
  32. data/lib/childprocess/version.rb +3 -3
  33. data/lib/childprocess/windows.rb +38 -33
  34. data/lib/childprocess/windows/handle.rb +91 -91
  35. data/lib/childprocess/windows/io.rb +25 -25
  36. data/lib/childprocess/windows/lib.rb +416 -416
  37. data/lib/childprocess/windows/process.rb +130 -130
  38. data/lib/childprocess/windows/process_builder.rb +178 -175
  39. data/lib/childprocess/windows/structs.rb +148 -148
  40. data/spec/abstract_io_spec.rb +12 -12
  41. data/spec/childprocess_spec.rb +447 -422
  42. data/spec/get_env.ps1 +13 -0
  43. data/spec/io_spec.rb +228 -228
  44. data/spec/jruby_spec.rb +24 -24
  45. data/spec/pid_behavior.rb +12 -12
  46. data/spec/platform_detection_spec.rb +86 -86
  47. data/spec/spec_helper.rb +270 -261
  48. data/spec/unix_spec.rb +57 -57
  49. data/spec/windows_spec.rb +23 -23
  50. metadata +8 -39
@@ -1,57 +1,57 @@
1
- require File.expand_path('../spec_helper', __FILE__)
2
- require "pid_behavior"
3
-
4
- if ChildProcess.unix? && !ChildProcess.jruby? && !ChildProcess.posix_spawn?
5
-
6
- describe ChildProcess::Unix::Process do
7
- it_behaves_like "a platform that provides the child's pid"
8
-
9
- it "handles ECHILD race condition where process dies between timeout and KILL" do
10
- process = sleeping_ruby
11
-
12
- allow(process).to receive(:fork).and_return('fakepid')
13
- allow(process).to receive(:send_term)
14
- allow(process).to receive(:poll_for_exit).and_raise(ChildProcess::TimeoutError)
15
- allow(process).to receive(:send_kill).and_raise(Errno::ECHILD.new)
16
-
17
- process.start
18
- expect { process.stop }.not_to raise_error
19
-
20
- allow(process).to receive(:alive?).and_return(false)
21
-
22
- process.send(:send_signal, 'TERM')
23
- end
24
-
25
- it "handles ESRCH race condition where process dies between timeout and KILL" do
26
- process = sleeping_ruby
27
-
28
- allow(process).to receive(:fork).and_return('fakepid')
29
- allow(process).to receive(:send_term)
30
- allow(process).to receive(:poll_for_exit).and_raise(ChildProcess::TimeoutError)
31
- allow(process).to receive(:send_kill).and_raise(Errno::ESRCH.new)
32
-
33
- process.start
34
- expect { process.stop }.not_to raise_error
35
-
36
- allow(process).to receive(:alive?).and_return(false)
37
-
38
- process.send(:send_signal, 'TERM')
39
- end
40
- end
41
-
42
- describe ChildProcess::Unix::IO do
43
- let(:io) { ChildProcess::Unix::IO.new }
44
-
45
- it "raises an ArgumentError if given IO does not respond to :to_io" do
46
- expect { io.stdout = nil }.to raise_error(ArgumentError, /to respond to :to_io/)
47
- end
48
-
49
- it "raises a TypeError if #to_io does not return an IO" do
50
- fake_io = Object.new
51
- def fake_io.to_io() StringIO.new end
52
-
53
- expect { io.stdout = fake_io }.to raise_error(TypeError, /expected IO, got/)
54
- end
55
- end
56
-
57
- end
1
+ require File.expand_path('../spec_helper', __FILE__)
2
+ require "pid_behavior"
3
+
4
+ if ChildProcess.unix? && !ChildProcess.jruby? && !ChildProcess.posix_spawn?
5
+
6
+ describe ChildProcess::Unix::Process do
7
+ it_behaves_like "a platform that provides the child's pid"
8
+
9
+ it "handles ECHILD race condition where process dies between timeout and KILL" do
10
+ process = sleeping_ruby
11
+
12
+ allow(process).to receive(:fork).and_return('fakepid')
13
+ allow(process).to receive(:send_term)
14
+ allow(process).to receive(:poll_for_exit).and_raise(ChildProcess::TimeoutError)
15
+ allow(process).to receive(:send_kill).and_raise(Errno::ECHILD.new)
16
+
17
+ process.start
18
+ expect { process.stop }.not_to raise_error
19
+
20
+ allow(process).to receive(:alive?).and_return(false)
21
+
22
+ process.send(:send_signal, 'TERM')
23
+ end
24
+
25
+ it "handles ESRCH race condition where process dies between timeout and KILL" do
26
+ process = sleeping_ruby
27
+
28
+ allow(process).to receive(:fork).and_return('fakepid')
29
+ allow(process).to receive(:send_term)
30
+ allow(process).to receive(:poll_for_exit).and_raise(ChildProcess::TimeoutError)
31
+ allow(process).to receive(:send_kill).and_raise(Errno::ESRCH.new)
32
+
33
+ process.start
34
+ expect { process.stop }.not_to raise_error
35
+
36
+ allow(process).to receive(:alive?).and_return(false)
37
+
38
+ process.send(:send_signal, 'TERM')
39
+ end
40
+ end
41
+
42
+ describe ChildProcess::Unix::IO do
43
+ let(:io) { ChildProcess::Unix::IO.new }
44
+
45
+ it "raises an ArgumentError if given IO does not respond to :to_io" do
46
+ expect { io.stdout = nil }.to raise_error(ArgumentError, /to respond to :to_io/)
47
+ end
48
+
49
+ it "raises a TypeError if #to_io does not return an IO" do
50
+ fake_io = Object.new
51
+ def fake_io.to_io() StringIO.new end
52
+
53
+ expect { io.stdout = fake_io }.to raise_error(TypeError, /expected IO, got/)
54
+ end
55
+ end
56
+
57
+ end
@@ -1,23 +1,23 @@
1
- require File.expand_path('../spec_helper', __FILE__)
2
- require "pid_behavior"
3
-
4
- if ChildProcess.windows?
5
- describe ChildProcess::Windows::Process do
6
- it_behaves_like "a platform that provides the child's pid"
7
- end
8
-
9
- describe ChildProcess::Windows::IO do
10
- let(:io) { ChildProcess::Windows::IO.new }
11
-
12
- it "raises an ArgumentError if given IO does not respond to :fileno" do
13
- expect { io.stdout = nil }.to raise_error(ArgumentError, /must have :fileno or :to_io/)
14
- end
15
-
16
- it "raises an ArgumentError if the #to_io does not return an IO " do
17
- fake_io = Object.new
18
- def fake_io.to_io() StringIO.new end
19
-
20
- expect { io.stdout = fake_io }.to raise_error(ArgumentError, /must have :fileno or :to_io/)
21
- end
22
- end
23
- end
1
+ require File.expand_path('../spec_helper', __FILE__)
2
+ require "pid_behavior"
3
+
4
+ if ChildProcess.windows?
5
+ describe ChildProcess::Windows::Process do
6
+ it_behaves_like "a platform that provides the child's pid"
7
+ end
8
+
9
+ describe ChildProcess::Windows::IO do
10
+ let(:io) { ChildProcess::Windows::IO.new }
11
+
12
+ it "raises an ArgumentError if given IO does not respond to :fileno" do
13
+ expect { io.stdout = nil }.to raise_error(ArgumentError, /must have :fileno or :to_io/)
14
+ end
15
+
16
+ it "raises an ArgumentError if the #to_io does not return an IO " do
17
+ fake_io = Object.new
18
+ def fake_io.to_io() StringIO.new end
19
+
20
+ expect { io.stdout = fake_io }.to raise_error(ArgumentError, /must have :fileno or :to_io/)
21
+ end
22
+ end
23
+ end
metadata CHANGED
@@ -1,36 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: childprocess
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jari Bakken
8
8
  - Eric Kessler
9
+ - Shane da Silva
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2018-03-10 00:00:00.000000000 Z
13
+ date: 2019-09-20 00:00:00.000000000 Z
13
14
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: ffi
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - "~>"
19
- - !ruby/object:Gem::Version
20
- version: '1.0'
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 1.0.11
24
- type: :runtime
25
- prerelease: false
26
- version_requirements: !ruby/object:Gem::Requirement
27
- requirements:
28
- - - "~>"
29
- - !ruby/object:Gem::Version
30
- version: '1.0'
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 1.0.11
34
15
  - !ruby/object:Gem::Dependency
35
16
  name: rspec
36
17
  requirement: !ruby/object:Gem::Requirement
@@ -59,20 +40,6 @@ dependencies:
59
40
  - - "~>"
60
41
  - !ruby/object:Gem::Version
61
42
  version: '0.0'
62
- - !ruby/object:Gem::Dependency
63
- name: rake
64
- requirement: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "<"
67
- - !ruby/object:Gem::Version
68
- version: '12.0'
69
- type: :development
70
- prerelease: false
71
- version_requirements: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "<"
74
- - !ruby/object:Gem::Version
75
- version: '12.0'
76
43
  - !ruby/object:Gem::Dependency
77
44
  name: coveralls
78
45
  requirement: !ruby/object:Gem::Requirement
@@ -91,6 +58,7 @@ description: This gem aims at being a simple and reliable solution for controlli
91
58
  external programs running in the background on any Ruby / OS combination.
92
59
  email:
93
60
  - morrow748@gmail.com
61
+ - shane@dasilva.io
94
62
  executables: []
95
63
  extensions: []
96
64
  extra_rdoc_files: []
@@ -135,6 +103,7 @@ files:
135
103
  - lib/childprocess/windows/structs.rb
136
104
  - spec/abstract_io_spec.rb
137
105
  - spec/childprocess_spec.rb
106
+ - spec/get_env.ps1
138
107
  - spec/io_spec.rb
139
108
  - spec/jruby_spec.rb
140
109
  - spec/pid_behavior.rb
@@ -154,15 +123,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
154
123
  requirements:
155
124
  - - ">="
156
125
  - !ruby/object:Gem::Version
157
- version: '0'
126
+ version: 2.3.0
158
127
  required_rubygems_version: !ruby/object:Gem::Requirement
159
128
  requirements:
160
129
  - - ">="
161
130
  - !ruby/object:Gem::Version
162
131
  version: '0'
163
132
  requirements: []
164
- rubyforge_project: childprocess
165
- rubygems_version: 2.5.2
133
+ rubygems_version: 3.0.3
166
134
  signing_key:
167
135
  specification_version: 4
168
136
  summary: A simple and reliable solution for controlling external programs running
@@ -170,6 +138,7 @@ summary: A simple and reliable solution for controlling external programs runnin
170
138
  test_files:
171
139
  - spec/abstract_io_spec.rb
172
140
  - spec/childprocess_spec.rb
141
+ - spec/get_env.ps1
173
142
  - spec/io_spec.rb
174
143
  - spec/jruby_spec.rb
175
144
  - spec/pid_behavior.rb