Sha256: 41d687be07c579b3419c39e1b70945262b0c6c4851326719210f5bb633306015

Contents?: true

Size: 1.24 KB

Versions: 19

Compression:

Stored size: 1.24 KB

Contents

require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/../../spec_helper'

describe "Process.waitall" do
  before :all do
    Process.waitall
  end

  it "returns an empty array when there are no children" do
    Process.waitall.should == []
  end

  it "takes no arguments" do
    lambda { Process.waitall(0) }.should raise_error(ArgumentError)
  end

  platform_is_not :windows do
    it "waits for all children" do
      pids = []
      pids << Process.fork { Process.exit! 2 }
      pids << Process.fork { Process.exit! 1 }
      pids << Process.fork { Process.exit! 0 }
      Process.waitall
      pids.each { |pid|
        lambda { Process.kill(0, pid) }.should raise_error(Errno::ESRCH)
      }
    end

    it "returns an array of pid/status pairs" do
      pids = []
      pids << Process.fork { Process.exit! 2 }
      pids << Process.fork { Process.exit! 1 }
      pids << Process.fork { Process.exit! 0 }
      a = Process.waitall
      a.class.should == Array
      a.size.should == 3
      pids.each { |pid|
        pid_status = a.assoc(pid)
        pid_status.class.should == Array
        pid_status.size.should == 2
        pid_status.first.should == pid
        pid_status.last.class.should == Process::Status
      }
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
rhodes-2.0.0.beta11 spec/framework_spec/app/spec/core/process/waitall_spec.rb
rhodes-2.0.0.beta10 spec/framework_spec/app/spec/core/process/waitall_spec.rb
rhodes-2.0.0.beta9 spec/framework_spec/app/spec/core/process/waitall_spec.rb
rhodes-2.0.0.beta8 spec/framework_spec/app/spec/core/process/waitall_spec.rb
rhodes-2.0.0.beta7 spec/framework_spec/app/spec/core/process/waitall_spec.rb
rhodes-2.0.0.beta6 spec/framework_spec/app/spec/core/process/waitall_spec.rb
rhodes-2.0.0.beta4 spec/framework_spec/app/spec/core/process/waitall_spec.rb
rhodes-2.0.0.beta3 spec/framework_spec/app/spec/core/process/waitall_spec.rb
rhodes-1.5.5 spec/framework_spec/app/spec/core/process/waitall_spec.rb
rhodes-2.0.0.beta2 spec/framework_spec/app/spec/core/process/waitall_spec.rb
rhodes-2.0.0.beta1 spec/framework_spec/app/spec/core/process/waitall_spec.rb
rhodes-1.5.4 spec/framework_spec/app/spec/core/process/waitall_spec.rb
rhodes-1.5.3 spec/framework_spec/app/spec/core/process/waitall_spec.rb
rhodes-1.5.2 spec/framework_spec/app/spec/core/process/waitall_spec.rb
rhodes-1.5.1 spec/framework_spec/app/spec/core/process/waitall_spec.rb
rhodes-1.5.0 spec/framework_spec/app/spec/core/process/waitall_spec.rb
rhodes-1.4.2 spec/framework_spec/app/spec/core/process/waitall_spec.rb
rhodes-1.4.1 spec/framework_spec/app/spec/core/process/waitall_spec.rb
rhodes-1.4.0 spec/framework_spec/app/spec/core/process/waitall_spec.rb