spork 1.0.0rc2 → 1.0.0rc3

Sign up to get free protection for your applications and to get access to all the features.
@@ -32,7 +32,7 @@ class Spork::Diagnoser
32
32
  end
33
33
  private :require
34
34
 
35
- def load(string)
35
+ def load(string, wrap = false)
36
36
  ::Spork::Diagnoser.add_included_file(string, caller)
37
37
  load_without_diagnoser(string)
38
38
  end
@@ -37,17 +37,18 @@ class Spork::Forker
37
37
  #
38
38
  # If the fork was aborted, then result returns nil.
39
39
  def result
40
- return unless running?
40
+ return @result if defined?(@result) || ! running?
41
41
  result_thread = Thread.new do
42
42
  begin
43
43
  @result = Marshal.load(@server_io)
44
44
  Marshal.dump('ACK', @server_io)
45
- rescue ForkDiedException, EOFError
45
+ rescue EOFError
46
46
  @result = nil
47
+ rescue ForkDiedException
47
48
  end
48
49
  end
49
50
  Process.wait(@child_pid)
50
- result_thread.raise(ForkDiedException) if @result.nil?
51
+ result_thread.raise(ForkDiedException) if result_thread.status == "sleep"
51
52
  @child_pid = nil
52
53
  @result
53
54
  end
@@ -29,7 +29,12 @@ describe Spork::Forker do
29
29
  it "aborts a fork and returns nil for the result" do
30
30
  started_at = Time.now
31
31
  ended_at = nil
32
- forker = Spork::Forker.new { sleep 5 }
32
+ forker = Spork::Forker.new do
33
+ begin
34
+ sleep 5
35
+ rescue SignalException
36
+ end
37
+ end
33
38
  Thread.new do
34
39
  forker.result.should == nil
35
40
  ended_at = Time.now
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spork
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0rc2
4
+ version: 1.0.0rc3
5
5
  prerelease: 5
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-02-08 00:00:00.000000000Z
13
+ date: 2012-05-04 00:00:00.000000000Z
14
14
  dependencies: []
15
15
  description: A forking Drb spec server
16
16
  email: