Method: Spring::Server#write_pidfile

Defined in:
lib/spring/server.rb

#write_pidfileObject



106
107
108
109
110
111
112
113
114
# File 'lib/spring/server.rb', line 106

def write_pidfile
  if @pidfile.flock(File::LOCK_EX | File::LOCK_NB)
    @pidfile.truncate(0)
    @pidfile.write("#{Process.pid}\n")
    @pidfile.fsync
  else
    exit 1
  end
end