childprocess 3.0.0 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b3927c01811510b0458e140f2b6f0fc6974f15ef733af515fa1d1b30976af4f4
4
- data.tar.gz: 82883fa302f9e1698cff900a88cf5662e4561b5ca6fb5c6a794eccb65fc89d96
3
+ metadata.gz: 7a5e6dc8970dbfa81b42c587480b4cd7a564995c2a6a0be84f2c8192edcf6d0c
4
+ data.tar.gz: 766be22f3575a6ef9ba837a37722f0a852f509fc9efb2a77b01ca121b865a28e
5
5
  SHA512:
6
- metadata.gz: 98d6faa166068b1f9186cbf817ac5623e22212a7cd434b5a9213be80bf2e13df8d517513a772a5e5abf3a81c3dfe930c75bfd3f822423bf9e9259230dd4a26bd
7
- data.tar.gz: 92082f9fb2ca7ec07bcaefcb1c0cd2619305204bbc7872090b485e694e36879e4de4d6abc460867a2715ea0214b0aeef16d67016fa0f36280028aa391b27ca94
6
+ metadata.gz: 8e4ac84967566de68d200d983bfebca6fce9575d7e8fb0aa0324b64dc4b6e0d29d29abe173ce99a54f8b37501eb515573b457f6b612a395f3f5d2bc672da6802
7
+ data.tar.gz: 16bc7aaffd67ab47f1f8a8ded31681fb88f1767421838c3ddb1f1033fb7dc0f5c5d664b7dce3fb4107edb9818a73ce2769f23a3e1f30bf51ffc3dd088d8a7690
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
- # RubyGems update is supported for Ruby 2.3 and later
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,16 @@
1
+ ### Version 4.1.0 / 2021-06-08
2
+
3
+ * [#170](https://github.com/enkessler/childprocess/pull/170): Update gem homepage to use `https://`
4
+ * [#177](https://github.com/enkessler/childprocess/pull/177): Add ARM64-macos support
5
+
6
+ ### Version 4.0.0 / 2020-06-18
7
+
8
+ * [#167](https://github.com/enkessler/childprocess/pull/167): Fix detach behavior on Windows
9
+ * [#168](https://github.com/enkessler/childprocess/pull/168): Drop support for Ruby 2.3
10
+
1
11
  ### Version 3.0.0 / 2019-09-20
2
12
 
3
- * [#156](https://github.com/enkessler/childprocess/pull/156)Remove unused `rubyforge_project` from gemspec
13
+ * [#156](https://github.com/enkessler/childprocess/pull/156): Remove unused `rubyforge_project` from gemspec
4
14
  * [#160](https://github.com/enkessler/childprocess/pull/160): Remove extension to conditionally install `ffi` gem on Windows platforms
5
15
  * [#160](https://github.com/enkessler/childprocess/pull/160): Remove runtime dependency on `rake` gem
6
16
 
data/Gemfile CHANGED
@@ -6,16 +6,4 @@ gemspec
6
6
  # Used for local development/testing only
7
7
  gem 'rake'
8
8
 
9
- if RUBY_VERSION =~ /^1\./
10
- gem 'tins', '< 1.7' # The 'tins' gem requires Ruby 2.x on/after this version
11
- gem 'json', '< 2.0' # The 'json' gem drops pre-Ruby 2.x support on/after this version
12
- gem 'term-ansicolor', '< 1.4' # The 'term-ansicolor' gem requires Ruby 2.x on/after this version
13
-
14
- # ffi gem for Windows requires Ruby 2.x on/after this version
15
- gem 'ffi', '< 1.9.15' if ENV['CHILDPROCESS_POSIX_SPAWN'] == 'true' || Gem.win_platform?
16
- elsif Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.2')
17
- # Ruby 2.0/2.1 support only ffi before 1.10
18
- gem 'ffi', '~> 1.9.0' if ENV['CHILDPROCESS_POSIX_SPAWN'] == 'true' || Gem.win_platform?
19
- else
20
- gem 'ffi' if ENV['CHILDPROCESS_POSIX_SPAWN'] == 'true' || Gem.win_platform?
21
- end
9
+ gem 'ffi' if ENV['CHILDPROCESS_POSIX_SPAWN'] == 'true' || Gem.win_platform?
data/README.md CHANGED
@@ -14,7 +14,7 @@ a standalone library.
14
14
 
15
15
  # Requirements
16
16
 
17
- * Ruby 2.3+, JRuby 9+
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
- proc = ChildProcess.build("echo", "foo")
73
- proc.io.stdout = proc.io.stderr = w
74
- proc.start
75
-
76
- Thread.new {
77
- begin
78
- loop do
79
- print r.readpartial(8192)
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
- proc.wait
86
- w.close
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
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.authors = ["Jari Bakken", "Eric Kessler", "Shane da Silva"]
10
10
  s.email = ["morrow748@gmail.com", "shane@dasilva.io"]
11
- s.homepage = "http://github.com/enkessler/childprocess"
11
+ s.homepage = "https://github.com/enkessler/childprocess"
12
12
  s.summary = %q{A simple and reliable solution for controlling external programs running in the background on any Ruby / OS combination.}
13
13
  s.description = %q{This gem aims at being a simple and reliable solution for controlling external programs running in the background on any Ruby / OS combination.}
14
14
 
@@ -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.3.0'
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"
@@ -0,0 +1,11 @@
1
+ module ChildProcess::Unix::Platform
2
+ SIZEOF = {
3
+ :posix_spawn_file_actions_t => 8,
4
+ :posix_spawnattr_t => 8,
5
+ :sigset_t => 4
6
+ }
7
+ POSIX_SPAWN_RESETIDS = 1
8
+ POSIX_SPAWN_SETPGROUP = 2
9
+ POSIX_SPAWN_SETSIGDEF = 4
10
+ POSIX_SPAWN_SETSIGMASK = 8
11
+ end
@@ -1,3 +1,3 @@
1
1
  module ChildProcess
2
- VERSION = '3.0.0'
2
+ VERSION = '4.1.0'
3
3
  end
@@ -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] = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE | JOB_OBJECT_LIMIT_BREAKAWAY_OK
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
@@ -195,7 +195,7 @@ describe ChildProcess do
195
195
 
196
196
  Tempfile.open('grandparent_out') do |gp_file|
197
197
  # Create a parent and detached child process that will spit out their PID. Make sure that the child process lasts longer than the parent.
198
- p_process = ruby("require 'childprocess' ; c_process = ChildProcess.build('ruby', '-e', 'puts \\\"Child PID: \#{Process.pid}\\\" ; sleep 5') ; c_process.io.inherit! ; c_process.detach = true ; c_process.start ; puts \"Child PID: \#{c_process.pid}\" ; puts \"Parent PID: \#{Process.pid}\"")
198
+ p_process = ruby("$: << 'lib'; require 'childprocess' ; c_process = ChildProcess.build('ruby', '-e', 'puts \\\"Child PID: \#{Process.pid}\\\" ; sleep 5') ; c_process.io.inherit! ; c_process.detach = true ; c_process.start ; puts \"Child PID: \#{c_process.pid}\" ; puts \"Parent PID: \#{Process.pid}\"")
199
199
  p_process.io.stdout = p_process.io.stderr = gp_file
200
200
 
201
201
  # Let the parent process die
data/spec/io_spec.rb CHANGED
@@ -138,7 +138,7 @@ describe ChildProcess do
138
138
 
139
139
  stdin.close
140
140
  process.poll_for_exit(exit_timeout)
141
- ensure
141
+ ensure
142
142
  out_receiver.close
143
143
  out.close
144
144
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: childprocess
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jari Bakken
8
8
  - Eric Kessler
9
9
  - Shane da Silva
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-09-20 00:00:00.000000000 Z
13
+ date: 2021-06-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
@@ -87,6 +87,7 @@ files:
87
87
  - lib/childprocess/unix/fork_exec_process.rb
88
88
  - lib/childprocess/unix/io.rb
89
89
  - lib/childprocess/unix/lib.rb
90
+ - lib/childprocess/unix/platform/arm64-macosx.rb
90
91
  - lib/childprocess/unix/platform/i386-linux.rb
91
92
  - lib/childprocess/unix/platform/i386-solaris.rb
92
93
  - lib/childprocess/unix/platform/x86_64-linux.rb
@@ -111,11 +112,11 @@ files:
111
112
  - spec/spec_helper.rb
112
113
  - spec/unix_spec.rb
113
114
  - spec/windows_spec.rb
114
- homepage: http://github.com/enkessler/childprocess
115
+ homepage: https://github.com/enkessler/childprocess
115
116
  licenses:
116
117
  - MIT
117
118
  metadata: {}
118
- post_install_message:
119
+ post_install_message:
119
120
  rdoc_options: []
120
121
  require_paths:
121
122
  - lib
@@ -123,15 +124,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
123
124
  requirements:
124
125
  - - ">="
125
126
  - !ruby/object:Gem::Version
126
- version: 2.3.0
127
+ version: 2.4.0
127
128
  required_rubygems_version: !ruby/object:Gem::Requirement
128
129
  requirements:
129
130
  - - ">="
130
131
  - !ruby/object:Gem::Version
131
132
  version: '0'
132
133
  requirements: []
133
- rubygems_version: 3.0.3
134
- signing_key:
134
+ rubygems_version: 3.1.4
135
+ signing_key:
135
136
  specification_version: 4
136
137
  summary: A simple and reliable solution for controlling external programs running
137
138
  in the background on any Ruby / OS combination.