Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rubinius/rubinius
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 86bedce46708
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d49a89ad5e68
Choose a head ref
  • 2 commits
  • 5 files changed
  • 1 contributor

Commits on Jun 7, 2016

  1. Copy the full SHA
    85621dc View commit details
  2. Copy the full SHA
    d49a89a View commit details
4 changes: 2 additions & 2 deletions machine/builtin/system.cpp
Original file line number Diff line number Diff line change
@@ -513,7 +513,7 @@ namespace rubinius {
if(size != 0) {
{
UnmanagedPhase unmanaged(state);
int status, options = WNOHANG;
int status, options = 0;

waitpid(pid, &status, options);
}
@@ -633,7 +633,7 @@ namespace rubinius {
if(size != 0) {
{
UnmanagedPhase unmanaged(state);
int status, options = WNOHANG;
int status, options = 0;

waitpid(pid, &status, options);
}
47 changes: 27 additions & 20 deletions spec/ruby/core/objectspace/define_finalizer_spec.rb
Original file line number Diff line number Diff line change
@@ -63,32 +63,38 @@ def handler.call(obj) end
with_feature :fork do
it "calls finalizer on process termination" do
rd, wr = IO.pipe
if Kernel::fork then
wr.close
rd.read.should == "finalized"
rd.close
else

pid = Kernel::fork do
rd.close
handler = ObjectSpaceFixtures.scoped(wr)
obj = "Test"
ObjectSpace.define_finalizer(obj, handler)
exit 0
end

wr.close
Process.waitpid pid

rd.read.should == "finalized"
rd.close
end

it "calls finalizer at exit even if it is self-referencing" do
rd, wr = IO.pipe
if Kernel::fork then
wr.close
rd.read.should == "finalized"
rd.close
else

pid = Kernel::fork do
rd.close
obj = "Test"
handler = Proc.new { wr.write "finalized"; wr.close }
ObjectSpace.define_finalizer(obj, handler)
exit 0
end

wr.close
Process.waitpid pid

rd.read.should == "finalized"
rd.close
end

# These specs are defined under the fork specs because there is no
@@ -98,16 +104,7 @@ def handler.call(obj) end
rd1, wr1 = IO.pipe
rd2, wr2 = IO.pipe

if Kernel::fork then
wr1.close
wr2.close

rd1.read.should == "finalized1"
rd2.read.should == "finalized2"

rd1.close
rd2.close
else
pid = Kernel::fork do
rd1.close
rd2.close
obj = mock("ObjectSpace.define_finalizer multiple")
@@ -117,6 +114,16 @@ def handler.call(obj) end

exit 0
end

wr1.close
wr2.close
Process.waitpid pid

rd1.read.should == "finalized1"
rd2.read.should == "finalized2"

rd1.close
rd2.close
end
end
end
2 changes: 2 additions & 0 deletions spec/ruby/core/process/setpgid_spec.rb
Original file line number Diff line number Diff line change
@@ -20,6 +20,8 @@

wr.write ' '
wr.close

Process.waitpid pid
end
end
end
6 changes: 6 additions & 0 deletions spec/ruby/core/process/setpgrp_spec.rb
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@
# and another for the parent to let the child know that it's ok to die.
read1, write1 = IO.pipe
read2, write2 = IO.pipe

pid = Process.fork do
read1.close
write2.close
@@ -20,15 +21,20 @@
read2.close
Process.exit!
end


write1.close
read2.close

pgid = read1.read # wait for child to change process groups
read1.close

Process.getpgid(pid).should == pgid.to_i

write2 << "!"
write2.close

Process.waitpid pid
end

end
8 changes: 6 additions & 2 deletions spec/ruby/core/process/setsid_spec.rb
Original file line number Diff line number Diff line change
@@ -4,7 +4,8 @@
with_feature :fork do
it "establishes this process as a new session and process group leader" do
read, write = IO.pipe
pid = Process.fork {

pid = Process.fork do
begin
read.close
pgid = Process.setsid
@@ -14,8 +15,11 @@
write << e << e.backtrace
end
Process.exit!
}
end

write.close
Process.waitpid pid

klass = read.gets
read.close
klass.should == "Fixnum"