Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Use UNIXSocket to pass file descriptor #38434

Closed
wants to merge 1 commit into from
Closed

Use UNIXSocket to pass file descriptor #38434

wants to merge 1 commit into from

Conversation

xu-cheng
Copy link
Member

@xu-cheng xu-cheng commented Apr 7, 2015

@jacknagel It works. Thanks for the tip.

Github doesn't allow me reopen the original PR after I run push --force. So open a new one.

rescue Errno::EAGAIN, Errno::EWOULDBLOCK, Errno::ECONNABORTED, Errno::EPROTO, Errno::EINTR
retry unless Process.waitpid(pid, Process::WNOHANG)
end
socket.send_io(write) unless socket.nil?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be able to do

begin
  # ...
rescue # ...
  # ...
else
  socket.send_io(write)
end

and skip the nil check here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. Though socket.nil? is still required in Process.wait(pid)

This is a more standard way to pass fd in UNIX world.
At the same time, it helps to remove a few hacks and
simplifies the code in the sandbox.
@xu-cheng
Copy link
Member Author

xu-cheng commented Apr 9, 2015

Any more suggestion before I merge this?

@MikeMcQuaid
Copy link
Member

LGTM 👍

@xu-cheng xu-cheng closed this in c74b552 Apr 9, 2015
@xu-cheng xu-cheng deleted the socket branch April 9, 2015 07:45
@Homebrew Homebrew locked and limited conversation to collaborators Jul 10, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants