Subject: | test.pl for IO::Pty need critical fix |
This issue was also reported by someone else to the Perl Monks site:
http://www.perlmonks.org/?displaytype=print;node_id=857756;replies=1
With the latest version of Cygwin 1.7.7-1 IO::Pty builds fine, but the
test hangs and does not return. To resolve this, not just for Cygwin,
but also for AIX where I encountered the same behavior (but not in
Ubuntu or Linux or Solaris), the master PTY has to be explicitly CLOSED.
This is the current 'unless' block in test.pl (starting at LINE 37):
unless ($pid) {
# child closes stdin/out and reports test result via exit status
sleep 0;
close STDIN;
close STDOUT;
my $master = new IO::Pty;
my $slave = $master->slave();
if ($master->fileno < 3 or $slave->fileno < 3) {
die 'ERROR: masterfd='.$master->fileno.',
slavefd='.$slave->fileno."\n";
}
exit(0);
}
AND here is one I modified in order to introduce the needed close command:
unless ($pid) {
# child closes stdin/out and reports test result via exit status
sleep 0;
close STDIN;
close STDOUT;
my $master = new IO::Pty;
my $slave = $master->slave();
my $master_fileno=$master->fileno; # new
my $slave_fileno=$slave->fileno; # new
$master->close(); # new CRITICAL
if ($master->fileno < 3 or $slave->fileno < 3) { # altered
die 'ERROR: masterfd='.$master->fileno.',
slavefd='.$slave->fileno."\n"; # altered
}
exit(0);
}
I've tested this change thoroughly, and it is the only one needed. My
Net::FullAuto module is dependent on IO::Pty, and I *need* this to
install cleanly in Cygwin and AIX via the CPAN.
Thanks for your help.
Brian Kelly (author of Term::Menus and Net::FullAuto)