Sha256: 45d149dd35edeff29545daf002e4c0be318ad34d217245f243bbb7bedffc43df

Contents?: true

Size: 1.12 KB

Versions: 52

Compression:

Stored size: 1.12 KB

Contents

require File.expand_path('../../../spec_helper', __FILE__)

if System.get_property('platform') != 'APPLE'
describe "Process.fork" do
  # As of 1.9 Process.respond_to?(:fork) returns false on platforms that do
  # not implement it.
  ruby_version_is "1.9" do
    platform_is :windows do
      it "is not implemented" do
        Process.respond_to?(:fork).should be_false
      end
    end
  end

  platform_is_not :windows do
    not_supported_on :jruby do
      before :each do
        @file = tmp('i_exist')
        rm_r @file
      end

      after :each do
        rm_r @file
      end

      it "return nil for the child process" do
        child_id = Process.fork
        if child_id == nil
          touch(@file) { |f| f.write 'rubinius' }
          Process.exit!
        else
          Process.waitpid(child_id)
        end
        File.exist?(@file).should == true
      end

      it "runs a block in a child process" do
        pid = Process.fork {
          touch(@file) { |f| f.write 'rubinius' }
          Process.exit!
        }
        Process.waitpid(pid)
        File.exist?(@file).should == true
      end
    end
  end
end
end

Version data entries

52 entries across 52 versions & 2 rubygems

Version Path
rhodes-7.6.0 spec/framework_spec/app/spec/core/process/fork_spec.rb
rhodes-7.5.1 spec/framework_spec/app/spec/core/process/fork_spec.rb
rhodes-7.4.1 spec/framework_spec/app/spec/core/process/fork_spec.rb
rhodes-7.1.17 spec/framework_spec/app/spec/core/process/fork_spec.rb
rhodes-6.2.0 spec/framework_spec/app/spec/core/process/fork_spec.rb
rhodes-6.0.11 spec/framework_spec/app/spec/core/process/fork_spec.rb
rhodes-5.5.18 spec/framework_spec/app/spec/core/process/fork_spec.rb
rhodes-5.5.17 spec/framework_spec/app/spec/core/process/fork_spec.rb
rhodes-5.5.15 spec/framework_spec/app/spec/core/process/fork_spec.rb
rhodes-5.5.0.22 spec/framework_spec/app/spec/core/process/fork_spec.rb
rhodes-5.5.2 spec/framework_spec/app/spec/core/process/fork_spec.rb
rhodes-5.5.0.7 spec/framework_spec/app/spec/core/process/fork_spec.rb
rhodes-5.5.0.3 spec/framework_spec/app/spec/core/process/fork_spec.rb
rhodes-5.5.0 spec/framework_spec/app/spec/core/process/fork_spec.rb
tauplatform-1.0.3 spec/framework_spec/app/spec/core/process/fork_spec.rb
tauplatform-1.0.2 spec/framework_spec/app/spec/core/process/fork_spec.rb
tauplatform-1.0.1 spec/framework_spec/app/spec/core/process/fork_spec.rb
rhodes-3.5.1.12 spec/framework_spec/app/spec/core/process/fork_spec.rb
rhodes-3.3.5 spec/framework_spec/app/spec/core/process/fork_spec.rb
rhodes-3.4.2 spec/framework_spec/app/spec/core/process/fork_spec.rb