1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/socket/lib/socket.rb (Socket.unix_server_socket): call the block

if given.  remove the socket file when the block exits.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2009-02-11 07:51:53 +00:00
parent ff955766d4
commit 0a954e9117
3 changed files with 26 additions and 1 deletions

View file

@ -607,7 +607,16 @@ class Socket
if st && st.socket? && st.owned?
File.unlink path
end
Addrinfo.unix(path).listen
s = Addrinfo.unix(path).listen
if block_given?
begin
yield s
ensure
File.unlink path
end
else
s
end
end
# creates a UNIX socket server on _path_.