crystal-lang / crystal

The Crystal Programming Language
https://crystal-lang.org
Apache License 2.0
19.21k stars 1.61k forks source link

Don't pass socket file descriptors to subprocesses on Unix (`SOCK_CLOEXEC`) #14632

Closed carlhoerberg closed 1 month ago

carlhoerberg commented 1 month ago

The comment 8 lines down suggests that this has been lost at some point.

Fixes #14630

straight-shoota commented 1 month ago

suggestion: Add a simple spec to ensure this doesn't get lost somewhere. A simple check for close_on_exec? should do:

it "socket closes on exec by default" do
  socket = Socket.new(Socket::Family::INET, Socket::Type::STREAM, Socket::Protocol::TCP)
  socket.close_on_exec?.should be_true
end
ysbaddaden commented 1 month ago

I disabled the spec for windows. This is an UNIX only consideration.

straight-shoota commented 1 month ago

We still need to take a look at the Windows stuff. I've created #14636 to track that.