childprocess
childprocess copied to clipboard
Add backend based on Process.spawn
From https://github.com/enkessler/childprocess/issues/172
Coverage increased (+2.4%) to 92.727% when pulling 0eff297e3af25449c847716f7b0ac0c7aaebbc49 on eregon:process-spawn into 44227922488765ebad0c0bed0fbec586ef9f5c26 on enkessler:master.
TravisCI passes, except on JRuby: https://travis-ci.org/github/enkessler/childprocess/builds/759130946
TravisCI now passes with the latest JRuby, as good as master + actually it also works on ruby-head: https://travis-ci.org/github/enkessler/childprocess/builds/759183880 vs https://travis-ci.org/github/enkessler/childprocess/builds/759135035
This is almost ready now. CI: https://github.com/eregon/childprocess/runs/2869763551?check_suite_focus=true Linux & macOS pass.
Windows has only 2 failures:
Failures:
1) ChildProcess lets a detached child live on
Failure/Error: expect(alive?(p_pid)).to_not be true
expected not #<TrueClass:20> => true
got #<TrueClass:20> => true
Compared using equal?, which compares object identity.
# ./spec/childprocess_spec.rb:213:in `block (2 levels) in <top (required)>'
2) ChildProcess kills the full process tree
Failure/Error: raise msg
RuntimeError:
timed out after 3 seconds:
expected: false
got: true
(compared using eql?)
Diff:
@@ -1 +1 @@
-false
+true
# ./spec/spec_helper.rb:197:in `wait_until'
# ./spec/childprocess_spec.rb:291:in `block (3 levels) in <top (required)>'
# ./spec/childprocess_spec.rb:281:in `block (2 levels) in <top (required)>'
Finished in 22.11 seconds (files took 0.83769 seconds to load)
66 examples, 2 failures
The first one might be some issue with Process.detach
on Windows.
The second is the issue that there is no builtin way to kill a process group on Windows.
JRuby on Linux & macOS has only 1 failure:
1) ChildProcess can unset env vars
Failure/Error: expect(child_env).to_not have_key('CHILDPROCESS_UNSET')
expected `{"ACCEPT_EULA"=>"Y", "AGENT_TOOLSDIRECTORY"=>"/opt/hostedtoolcache", "ANDROID_HOME"=>"/usr/local/lib/...", "XDG_CONFIG_HOME"=>"/home/runner/.config", "_"=>"/home/runner/.rubies/jruby-9.2.19.0/bin/bundle"}.has_key?("CHILDPROCESS_UNSET")` to be falsey, got true
# ./spec/childprocess_spec.rb:161:in `block in <main>'
# ./spec/childprocess_spec.rb:150:in `block in <main>'
Which is most likely a bug of JRuby (since that works fine on CRuby).
JRuby on Windows doesn't seem to work well, due to another JRuby bug, Process.waitpid2
seems to return nil
for the status, which must be a JRuby bug.