-
-
Notifications
You must be signed in to change notification settings - Fork 928
Description
On Windows, Process.wait is not setting $? (or $CHILD_STATUS) and Process.wait2 is returning nil.
This is happening within my GitHub Actions. I created a simple test here that shows the behavior:
https://github.com/jcouball/process_spawn_test/actions/runs/3632082827
This workflow is a matrix build that runs the tests on two different JRuby and MRI versions on both Ubuntu and Windows. Only the JRuby builds on Windows fail.
The test code is very simple and can be found here:
https://github.com/jcouball/process_spawn_test/blob/main/spec/test_spec.rb
Duplicated here:
require 'English'
describe 'Process#wait' do
it 'should set the global $CHILD_STATUS variable' do
pid = Process.spawn('exit 0')
Process.wait(pid)
expect($CHILD_STATUS).not_to be_nil
expect($CHILD_STATUS.pid).to eq(pid)
end
end
describe 'Process#wait2' do
it 'should return a non-nil status' do
pid = Process.spawn('exit 0')
exited_pid, status = Process.wait2(pid)
expect(status).not_to be_nil
expect(status.pid).to eq(pid)
end
end
I suspect this might be a configuration error with the Windows image I am using. I don't have access to a Windows computer or virtual environment so can't debug it on my own. Also, my Windows experience is rusty.
Environment Information
The environment where I am seeing unexpected behavior:
- JRuby 9.3.9.0 and JRuby 9.4.0.0
- Windows Server 2022 (20221127 update) (see this page for more details of what is included in this Windows image)
- The following environment variables are included:
- JAVA_OPTS: -Djdk.io.File.enableADS=true
- JRUBY_OPTS: --debug -Xnative.verbose=true
- The Gemfile only includes the
rspec
gem
Environments where I see the expected behavior:
- JRuby 9.3.9.0 and JRuby 9.4.0.0 on Ubuntu
- MRI Rubys on both Ubuntu and Windows
Expected Behavior
Process.wait
should set $? / $CHILD_STATUSProcess.wait2
should return [pid, status] instead of nil.
Actual Behavior
- After calling
Process.wait
, $? / $CHILD_STATUS is nil. Process.wait2
is returning nil instead of [pid, status].