My commit
df375c6d048b938ecdeaecc7b264a7f1a190120a attempted to
convert t/io/eintr.t from OS-based skipping to capability-based skipping,
but it only tested whether reads from pipes are interruptible.
Some OSes (like FreeBSD) only hang on write; so probe for that too.
{
my $pipe;
+ note("checking for read interruptibility...");
my $pid = eval { open($pipe, '-|') };
unless (defined $pid) {
skip_all("can't do -| open");
exit 0;
}
alarm(0);
+
+ $SIG{PIPE} = 'IGNORE';
+
+ note("checking for write interruptibility...");
+ $pid = eval { open($pipe, '|-') };
+ unless (defined $pid) {
+ skip_all("can't do |- open");
+ exit 0;
+ }
+ unless ($pid) {
+ #child
+ sleep 3;
+ close $pipe;
+ exit 0;
+ }
+
+ # parent
+
+ $intr = 0;
+ my $buf = "a" x 1_000_000 . "\n"; # bigger than any pipe buffer hopefully
+ alarm(1);
+ $x = print $pipe $buf;
+
+ unless ($intr) {
+ skip_all("writes aren't interruptible");
+ exit 0;
+ }
+ alarm(0);
}