Method: Spring::ApplicationManager#with_child

Defined in:
lib/spring/application_manager.rb

#with_childObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/spring/application_manager.rb', line 42

def with_child
  synchronize do
    if alive?
      begin
        yield
      rescue Errno::ECONNRESET, Errno::EPIPE
        # The child has died but has not been collected by the wait thread yet,
        # so start a new child and try again.
        log "child dead; starting"
        start
        yield
      end
    else
      log "child not running; starting"
      start
      yield
    end
  end
end