mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Add ability to cleanup stale unix sockets
This commit is contained in:
parent
7c73c52249
commit
f124bc21cd
1 changed files with 12 additions and 0 deletions
|
@ -255,6 +255,18 @@ module Puma
|
|||
|
||||
begin
|
||||
old_mask = File.umask(umask)
|
||||
|
||||
if File.exists? path
|
||||
begin
|
||||
old = UNIXSocket.new path
|
||||
rescue SystemCallError
|
||||
File.unlink path
|
||||
else
|
||||
old.close
|
||||
raise "There is already a server bound to: #{path}"
|
||||
end
|
||||
end
|
||||
|
||||
s = UNIXServer.new(path)
|
||||
@ios << s
|
||||
ensure
|
||||
|
|
Loading…
Add table
Reference in a new issue