Commits

Lars Kanis  committed 3558868

conn#socket() can not be used with IO.for_fd() on Windows.

  • Participants
  • Parent commits 9a84576

Comments (0)

Files changed (3)

File ext/pg_connection.c

  *    conn.socket() -> Fixnum
  *
  * Returns the socket's file descriptor for this connection.
+ * IO.for_fd() can be used to build a proper IO object to the socket.
+ *
+ * *Note:* On Windows the file descriptor is not really usable,
+ * since it can not be used to build a Ruby IO object.
  */
 static VALUE
 pgconn_socket(VALUE self)

File spec/lib/helpers.rb

 
 	config.mock_with :rspec
 	config.filter_run_excluding :ruby_19 if ruby_version_vec <= [1,9,1].pack( "N*" )
+	config.filter_run_excluding :unix if RUBY_PLATFORM =~ /mingw|mswin/
 
 	config.filter_run_excluding :postgresql_90 unless
 		PG::Connection.instance_methods.map( &:to_sym ).include?( :escape_literal )

File spec/pg/connection_spec.rb

 		}.to raise_error( ArgumentError, /extra positional parameter/i )
 	end
 
-	it "can connect asynchronously" do
+	it "can connect asynchronously", :unix do
 		tmpconn = described_class.connect_start( @conninfo )
 		tmpconn.should be_a( described_class )
 		socket = IO.for_fd( tmpconn.socket )
 		tmpconn.finish
 	end
 
-	it "can connect asynchronously for the duration of a block" do
+	it "can connect asynchronously for the duration of a block", :unix do
 		conn = nil
 
 		described_class.connect_start(@conninfo) do |tmpconn|
 	end
 
 
-	it "can connect asynchronously" do
+	it "can connect asynchronously", :unix do
 		serv = TCPServer.new( '127.0.0.1', 54320 )
 		conn = described_class.connect_start( '127.0.0.1', 54320, "", "", "me", "xxxx", "somedb" )
 		[PG::PGRES_POLLING_WRITING, PG::CONNECTION_OK].should include conn.connect_poll