Skip to content
This repository was archived by the owner on Aug 29, 2024. It is now read-only.

Commit 63bda06

Browse files
committed
Expose close_on_exec: option in shared endpoint.
1 parent 0d1fe79 commit 63bda06

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/async/io/shared_endpoint.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,21 @@ module IO
2727
# Pre-connect and pre-bind sockets so that it can be used between processes.
2828
class SharedEndpoint < Endpoint
2929
# Create a new `SharedEndpoint` by binding to the given endpoint.
30-
def self.bound(endpoint, backlog = Socket::SOMAXCONN)
30+
def self.bound(endpoint, backlog: Socket::SOMAXCONN, close_on_exec: false)
3131
wrappers = endpoint.bound do |server|
3232
server.listen(backlog)
33-
server.close_on_exec = false
33+
server.close_on_exec = close_on_exec
3434
server.reactor = nil
3535
end
3636

3737
return self.new(endpoint, wrappers)
3838
end
3939

4040
# Create a new `SharedEndpoint` by connecting to the given endpoint.
41-
def self.connected(endpoint)
41+
def self.connected(endpoint, close_on_exec: false)
4242
wrapper = endpoint.connect
4343

44-
wrapper.close_on_exec = false
44+
wrapper.close_on_exec = close_on_exec
4545
wrapper.reactor = nil
4646

4747
return self.new(endpoint, [wrapper])

0 commit comments

Comments
 (0)