childprocess 0.5.9 → 0.6.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 (47) hide show
  1. checksums.yaml +4 -4
  2. data/.document +6 -6
  3. data/.gitignore +25 -25
  4. data/.rspec +1 -1
  5. data/.travis.yml +20 -18
  6. data/CHANGELOG.md +8 -0
  7. data/Gemfile +11 -4
  8. data/LICENSE +20 -20
  9. data/README.md +178 -178
  10. data/Rakefile +61 -61
  11. data/childprocess.gemspec +30 -29
  12. data/lib/childprocess.rb +184 -177
  13. data/lib/childprocess/abstract_io.rb +36 -36
  14. data/lib/childprocess/abstract_process.rb +187 -187
  15. data/lib/childprocess/errors.rb +26 -26
  16. data/lib/childprocess/jruby.rb +56 -56
  17. data/lib/childprocess/jruby/io.rb +16 -16
  18. data/lib/childprocess/jruby/process.rb +159 -159
  19. data/lib/childprocess/jruby/pump.rb +52 -52
  20. data/lib/childprocess/tools/generator.rb +145 -145
  21. data/lib/childprocess/unix.rb +9 -9
  22. data/lib/childprocess/unix/fork_exec_process.rb +70 -70
  23. data/lib/childprocess/unix/io.rb +21 -21
  24. data/lib/childprocess/unix/lib.rb +186 -186
  25. data/lib/childprocess/unix/platform/i386-linux.rb +12 -12
  26. data/lib/childprocess/unix/platform/i386-solaris.rb +11 -11
  27. data/lib/childprocess/unix/platform/x86_64-linux.rb +12 -12
  28. data/lib/childprocess/unix/platform/x86_64-macosx.rb +11 -11
  29. data/lib/childprocess/unix/posix_spawn_process.rb +134 -134
  30. data/lib/childprocess/unix/process.rb +89 -89
  31. data/lib/childprocess/version.rb +3 -3
  32. data/lib/childprocess/windows.rb +33 -33
  33. data/lib/childprocess/windows/handle.rb +91 -91
  34. data/lib/childprocess/windows/io.rb +25 -25
  35. data/lib/childprocess/windows/lib.rb +415 -415
  36. data/lib/childprocess/windows/process.rb +129 -129
  37. data/lib/childprocess/windows/process_builder.rb +174 -174
  38. data/lib/childprocess/windows/structs.rb +148 -148
  39. data/spec/abstract_io_spec.rb +12 -12
  40. data/spec/childprocess_spec.rb +291 -256
  41. data/spec/io_spec.rb +228 -228
  42. data/spec/jruby_spec.rb +24 -24
  43. data/spec/pid_behavior.rb +12 -12
  44. data/spec/spec_helper.rb +253 -253
  45. data/spec/unix_spec.rb +57 -57
  46. data/spec/windows_spec.rb +23 -23
  47. metadata +47 -45
@@ -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,103 +1,105 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: childprocess
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.9
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jari Bakken
8
+ - Eric Kessler
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2016-01-06 00:00:00.000000000 Z
12
+ date: 2017-01-23 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
- name: rspec
15
+ name: ffi
15
16
  requirement: !ruby/object:Gem::Requirement
16
17
  requirements:
17
- - - ~>
18
+ - - "~>"
18
19
  - !ruby/object:Gem::Version
19
- version: 3.0.0
20
- type: :development
20
+ version: '1.0'
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.0.11
24
+ type: :runtime
21
25
  prerelease: false
22
26
  version_requirements: !ruby/object:Gem::Requirement
23
27
  requirements:
24
- - - ~>
28
+ - - "~>"
25
29
  - !ruby/object:Gem::Version
26
- version: 3.0.0
30
+ version: '1.0'
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.0.11
27
34
  - !ruby/object:Gem::Dependency
28
- name: yard
35
+ name: rspec
29
36
  requirement: !ruby/object:Gem::Requirement
30
37
  requirements:
31
- - - '>='
38
+ - - "~>"
32
39
  - !ruby/object:Gem::Version
33
- version: '0'
40
+ version: '3.0'
34
41
  type: :development
35
42
  prerelease: false
36
43
  version_requirements: !ruby/object:Gem::Requirement
37
44
  requirements:
38
- - - '>='
45
+ - - "~>"
39
46
  - !ruby/object:Gem::Version
40
- version: '0'
47
+ version: '3.0'
41
48
  - !ruby/object:Gem::Dependency
42
- name: rake
49
+ name: yard
43
50
  requirement: !ruby/object:Gem::Requirement
44
51
  requirements:
45
- - - ~>
52
+ - - "~>"
46
53
  - !ruby/object:Gem::Version
47
- version: 0.9.2
54
+ version: '0.0'
48
55
  type: :development
49
56
  prerelease: false
50
57
  version_requirements: !ruby/object:Gem::Requirement
51
58
  requirements:
52
- - - ~>
59
+ - - "~>"
53
60
  - !ruby/object:Gem::Version
54
- version: 0.9.2
61
+ version: '0.0'
55
62
  - !ruby/object:Gem::Dependency
56
- name: coveralls
63
+ name: rake
57
64
  requirement: !ruby/object:Gem::Requirement
58
65
  requirements:
59
- - - '>='
66
+ - - "<"
60
67
  - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
68
+ version: '12.0'
69
+ type: :runtime
63
70
  prerelease: false
64
71
  version_requirements: !ruby/object:Gem::Requirement
65
72
  requirements:
66
- - - '>='
73
+ - - "<"
67
74
  - !ruby/object:Gem::Version
68
- version: '0'
75
+ version: '12.0'
69
76
  - !ruby/object:Gem::Dependency
70
- name: ffi
77
+ name: coveralls
71
78
  requirement: !ruby/object:Gem::Requirement
72
79
  requirements:
73
- - - ~>
80
+ - - "<"
74
81
  - !ruby/object:Gem::Version
75
82
  version: '1.0'
76
- - - '>='
77
- - !ruby/object:Gem::Version
78
- version: 1.0.11
79
- type: :runtime
83
+ type: :development
80
84
  prerelease: false
81
85
  version_requirements: !ruby/object:Gem::Requirement
82
86
  requirements:
83
- - - ~>
87
+ - - "<"
84
88
  - !ruby/object:Gem::Version
85
89
  version: '1.0'
86
- - - '>='
87
- - !ruby/object:Gem::Version
88
- version: 1.0.11
89
90
  description: This gem aims at being a simple and reliable solution for controlling
90
91
  external programs running in the background on any Ruby / OS combination.
91
92
  email:
92
- - jari.bakken@gmail.com
93
+ - morrow748@gmail.com
93
94
  executables: []
94
95
  extensions: []
95
96
  extra_rdoc_files: []
96
97
  files:
97
- - .document
98
- - .gitignore
99
- - .rspec
100
- - .travis.yml
98
+ - ".document"
99
+ - ".gitignore"
100
+ - ".rspec"
101
+ - ".travis.yml"
102
+ - CHANGELOG.md
101
103
  - Gemfile
102
104
  - LICENSE
103
105
  - README.md
@@ -138,7 +140,7 @@ files:
138
140
  - spec/spec_helper.rb
139
141
  - spec/unix_spec.rb
140
142
  - spec/windows_spec.rb
141
- homepage: http://github.com/jarib/childprocess
143
+ homepage: http://github.com/enkessler/childprocess
142
144
  licenses:
143
145
  - MIT
144
146
  metadata: {}
@@ -148,21 +150,21 @@ require_paths:
148
150
  - lib
149
151
  required_ruby_version: !ruby/object:Gem::Requirement
150
152
  requirements:
151
- - - '>='
153
+ - - ">="
152
154
  - !ruby/object:Gem::Version
153
155
  version: '0'
154
156
  required_rubygems_version: !ruby/object:Gem::Requirement
155
157
  requirements:
156
- - - '>='
158
+ - - ">="
157
159
  - !ruby/object:Gem::Version
158
160
  version: '0'
159
161
  requirements: []
160
162
  rubyforge_project: childprocess
161
- rubygems_version: 2.0.14
163
+ rubygems_version: 2.6.7
162
164
  signing_key:
163
165
  specification_version: 4
164
- summary: This gem aims at being a simple and reliable solution for controlling external
165
- programs running in the background on any Ruby / OS combination.
166
+ summary: A simple and reliable solution for controlling external programs running
167
+ in the background on any Ruby / OS combination.
166
168
  test_files:
167
169
  - spec/abstract_io_spec.rb
168
170
  - spec/childprocess_spec.rb