mojolicious/mojo-pg

Can't dup: Bad file descriptor (Windows only)

bgilly1 opened this issue · 2 comments

  • Mojo::Pg version: 3.05
  • Perl version: 5.24.0 64-bit Strawberry Perl
  • Operating system: Windows 7

Steps to reproduce the behavior

use Mojo::Pg;
use Data::Dumper;
use feature 'say';
use warnings;
use strict;

my $pg = Mojo::Pg->new('postgresql://<user>:<pass>@<host>/<db>');
$pg = $pg->options({AutoCommit => 1, RaiseError => 1});

my $db = $pg->db;
my $dbh = $db->dbh;
say $dbh->{'pg_socket'}; #returns file no.
say $dbh->func('getfd'); #deprecated but still returns the same file no.
say Dumper tied %$dbh;
my $pubsub = Mojo::Pg::PubSub->new(pg => $pg, dbh => $dbh);
$pubsub->listen(foo => sub {});

Expected behavior

Should open $dbh->{'pg_socket'} as a handle in Database.pm

Here's the code it's trying to run in Database.pm

open $self->{handle}, '<&', $dbh->{pg_socket} or die "Can't dup: $!"; #line 148

Actual behavior

Can't dup: Bad file descriptor at C:/Strawberry/perl/site/lib/Mojo/Pg/Database.pm line 148.
Use of uninitialized value in delete at C:/Strawberry/perl/site/lib/Mojo/Reactor/Poll.pm line 91.

Works on Linux though.

kraih commented

I've tried to fix this but failed, therefore i'm afraid Windows Perl remains unsupported. dd12ad5

Thanks for taking a run at it 👍