perl-Tk/Tk-804.032-Use-pipe-instead-of-stdin-in-t-fileevent2.t.patch

48 lines
1.3 KiB
Diff

From 2ac8da8459e36d0a5479d9a86855ab3925ce8789 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Mon, 15 Sep 2014 10:14:11 +0200
Subject: [PATCH] Use pipe instead of stdin in t/fileevent2.t
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
t/fileevent2.t fails if standard input is not a blocking descriptor
without read events. E.g. /dev/null. This patch uses a private pipe
instead of relying on stdin which can be anything.
CPAN RT#98891
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
t/fileevent2.t | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/t/fileevent2.t b/t/fileevent2.t
index 825ec31..ad22198 100755
--- a/t/fileevent2.t
+++ b/t/fileevent2.t
@@ -21,7 +21,7 @@ BEGIN {
}
}
-plan tests => 1;
+plan tests => 2;
my @fh;
my $callback_called = 0;
@@ -35,8 +35,10 @@ $mw->idletasks;
#
# tclUnixNotify.c used to do bit-handling for the select() mask
# itself, but this was broken for 64bit machines.
+my ($rpipe, $wpipe);
+ok(pipe($rpipe, $wpipe), 'create blocking descriptors');
for (1..100) {
- open my $dup, "<&", \*STDIN or die "Can't dup STDIN: $!";
+ open my $dup, "<&", $rpipe or die "Can't dup rpipe: $!";
push @fh, $dup;
$mw->fileevent($dup, "readable", sub { $callback_called++ });
}
--
1.9.3