Method: Spring::ApplicationManager#run

Defined in:
lib/spring/application_manager.rb

#run(client) ⇒ Object

Returns the pid of the process running the command, or nil if the application process died.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/spring/application_manager.rb', line 63

def run(client)
  with_child do
    child.send_io client
    child.gets
  end

  pid = child.gets
  pid = pid.chomp.to_i if pid
  log "got worker pid #{pid}"
  pid
rescue Errno::ECONNRESET, Errno::EPIPE => e
  log "#{e} while reading from child; returning no pid"
  nil
ensure
  client.close
end