Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: Extensions
-
Labels:None
-
Environment:Mac OS X Leopard
-
Patch Submitted:Yes
-
Number of attachments :
Description
UNIXServer.for_fd doesn't work. Suppose that we have the following script which we run in MRI:
require 'socket'
File.unlink('test.sock') rescue nil
socket = UNIXServer.new('test.sock')
puts "Fileno = #
"
system("jirb -rsocket")
In the resulting jirb console we type:
UNIXServer.for_fd(...number that the above script printed...)
jirb currently throws an exception.
The attached patch fixes this problem: UNIXServer will accept a native file descriptor as argument. However I'm not sure how to write a unit test for this.
The test/spec should probably go into RubySpec, and I suppose just creating a server and a client and then creating another server object with for_fd would work fine; there's no real need to pass it across processes to show that for_fd is working, right?
Patch looks fine; I can apply it when we have some specs to include. Thank you!