childprocess 3.0.0 → 4.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.
- checksums.yaml +4 -4
- data/.travis.yml +1 -4
- data/CHANGELOG.md +5 -1
- data/README.md +25 -13
- data/appveyor.yml +0 -6
- data/childprocess.gemspec +1 -1
- data/lib/childprocess/version.rb +1 -1
- data/lib/childprocess/windows/process.rb +4 -3
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4e76f415dff2879680f9ca7c48442132fde2099dbdcd956aaf44b429269067b
|
4
|
+
data.tar.gz: b02b05e8ec6ad8a63c31cbaae6067cf5dae11e80b79850ebf9cf630e6fe69ddf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea2985d14f2b941e48dfa544c4531440560e6e4fc7c8edb1bdf68200099f9002cba20e033c0267a5f87bed8f886ae655dd3476c023f1133ce0729d7428610d8f
|
7
|
+
data.tar.gz: d962183e2e67e3612be72a7120a2a083bae78f738662cd8f0af7e50513b9936406814a25136e8a5cb7ae2c3166eb4d3ead38f85be834478b6fd26106c000dd56
|
data/.travis.yml
CHANGED
@@ -4,7 +4,6 @@ os:
|
|
4
4
|
|
5
5
|
rvm:
|
6
6
|
- rbx-3
|
7
|
-
- 2.3
|
8
7
|
- 2.4
|
9
8
|
- 2.5
|
10
9
|
- 2.6
|
@@ -16,9 +15,7 @@ cache: bundler
|
|
16
15
|
|
17
16
|
before_install:
|
18
17
|
- "echo 'gem: --no-document' > ~/.gemrc"
|
19
|
-
|
20
|
-
- ruby -e "system('gem update --system') if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.3')"
|
21
|
-
- gem install bundler --version '~> 1.17'
|
18
|
+
- gem install bundler
|
22
19
|
|
23
20
|
before_script:
|
24
21
|
- 'export JAVA_OPTS="${JAVA_OPTS_FOR_SPECS}"'
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
+
### Version 4.0.0 / 2020-06-18
|
2
|
+
|
3
|
+
* [#167](https://github.com/enkessler/childprocess/pull/167): Fix detach behavior on Windows
|
4
|
+
|
1
5
|
### Version 3.0.0 / 2019-09-20
|
2
6
|
|
3
|
-
* [#156](https://github.com/enkessler/childprocess/pull/156)Remove unused `rubyforge_project` from gemspec
|
7
|
+
* [#156](https://github.com/enkessler/childprocess/pull/156): Remove unused `rubyforge_project` from gemspec
|
4
8
|
* [#160](https://github.com/enkessler/childprocess/pull/160): Remove extension to conditionally install `ffi` gem on Windows platforms
|
5
9
|
* [#160](https://github.com/enkessler/childprocess/pull/160): Remove runtime dependency on `rake` gem
|
6
10
|
|
data/README.md
CHANGED
@@ -14,7 +14,7 @@ a standalone library.
|
|
14
14
|
|
15
15
|
# Requirements
|
16
16
|
|
17
|
-
* Ruby 2.
|
17
|
+
* Ruby 2.4+, JRuby 9+
|
18
18
|
|
19
19
|
Windows users **must** ensure the `ffi` gem (`>= 1.0.11`) is installed in order to use ChildProcess.
|
20
20
|
|
@@ -69,21 +69,33 @@ end
|
|
69
69
|
```ruby
|
70
70
|
r, w = IO.pipe
|
71
71
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
72
|
+
begin
|
73
|
+
process = ChildProcess.build("sh" , "-c",
|
74
|
+
"for i in {1..3}; do echo $i; sleep 1; done")
|
75
|
+
process.io.stdout = w
|
76
|
+
process.start # This results in a fork, inheriting the write end of the pipe.
|
77
|
+
|
78
|
+
# Close parent's copy of the write end of the pipe so when the (forked) child
|
79
|
+
# process closes its write end of the pipe the parent receives EOF when
|
80
|
+
# attempting to read from it. If the parent leaves its write end open, it
|
81
|
+
# will not detect EOF.
|
82
|
+
w.close
|
83
|
+
|
84
|
+
thread = Thread.new do
|
85
|
+
begin
|
86
|
+
loop do
|
87
|
+
print r.readpartial(16384)
|
88
|
+
end
|
89
|
+
rescue EOFError
|
90
|
+
# Child has closed the write end of the pipe
|
80
91
|
end
|
81
|
-
rescue EOFError
|
82
92
|
end
|
83
|
-
}
|
84
93
|
|
85
|
-
|
86
|
-
|
94
|
+
process.wait
|
95
|
+
thread.join
|
96
|
+
ensure
|
97
|
+
r.close
|
98
|
+
end
|
87
99
|
```
|
88
100
|
|
89
101
|
Note that if you just want to get the output of a command, the backtick method on Kernel may be a better fit.
|
data/appveyor.yml
CHANGED
@@ -2,12 +2,6 @@ version: '1.0.{build}'
|
|
2
2
|
|
3
3
|
environment:
|
4
4
|
matrix:
|
5
|
-
- CHILDPROCESS_POSIX_SPAWN: true
|
6
|
-
CHILDPROCESS_UNSET: should-be-unset
|
7
|
-
RUBY_VERSION: 23-x64
|
8
|
-
- CHILDPROCESS_POSIX_SPAWN: false
|
9
|
-
CHILDPROCESS_UNSET: should-be-unset
|
10
|
-
RUBY_VERSION: 23-x64
|
11
5
|
- CHILDPROCESS_POSIX_SPAWN: true
|
12
6
|
CHILDPROCESS_UNSET: should-be-unset
|
13
7
|
RUBY_VERSION: 24-x64
|
data/childprocess.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.test_files = `git ls-files -- spec/*`.split("\n")
|
19
19
|
s.require_paths = ["lib"]
|
20
20
|
|
21
|
-
s.required_ruby_version = '>= 2.
|
21
|
+
s.required_ruby_version = '>= 2.4.0'
|
22
22
|
|
23
23
|
s.add_development_dependency "rspec", "~> 3.0"
|
24
24
|
s.add_development_dependency "yard", "~> 0.0"
|
data/lib/childprocess/version.rb
CHANGED
@@ -71,7 +71,7 @@ module ChildProcess
|
|
71
71
|
@handle = Handle.open @pid
|
72
72
|
|
73
73
|
if leader?
|
74
|
-
@job = Job.new
|
74
|
+
@job = Job.new(detach?, true)
|
75
75
|
@job << @handle
|
76
76
|
end
|
77
77
|
|
@@ -93,7 +93,7 @@ module ChildProcess
|
|
93
93
|
|
94
94
|
|
95
95
|
class Job
|
96
|
-
def initialize
|
96
|
+
def initialize(detach, leader)
|
97
97
|
@pointer = Lib.create_job_object(nil, nil)
|
98
98
|
|
99
99
|
if @pointer.nil? || @pointer.null?
|
@@ -101,7 +101,8 @@ module ChildProcess
|
|
101
101
|
end
|
102
102
|
|
103
103
|
basic = JobObjectBasicLimitInformation.new
|
104
|
-
basic[:LimitFlags]
|
104
|
+
basic[:LimitFlags] |= JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE if !detach
|
105
|
+
basic[:LimitFlags] |= JOB_OBJECT_LIMIT_BREAKAWAY_OK if leader
|
105
106
|
|
106
107
|
extended = JobObjectExtendedLimitInformation.new
|
107
108
|
extended[:BasicLimitInformation] = basic
|
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:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jari Bakken
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2020-06-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|
@@ -123,14 +123,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
123
123
|
requirements:
|
124
124
|
- - ">="
|
125
125
|
- !ruby/object:Gem::Version
|
126
|
-
version: 2.
|
126
|
+
version: 2.4.0
|
127
127
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
requirements: []
|
133
|
-
rubygems_version: 3.
|
133
|
+
rubygems_version: 3.1.1
|
134
134
|
signing_key:
|
135
135
|
specification_version: 4
|
136
136
|
summary: A simple and reliable solution for controlling external programs running
|