This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #33928] chomp() fails after alarm(), `sleep`
[perl5.git] / t / op / alarm.t
index 8fb9296..b77a5ed 100644 (file)
@@ -13,7 +13,7 @@ BEGIN {
     }
 }
 
-plan tests => 4;
+plan tests => 5;
 my $Perl = which_perl();
 
 my $start_time = time;
@@ -49,3 +49,11 @@ is( $@, "ALARM!\n",             'alarm w/$SIG{ALRM} vs system()' );
                if $^O eq 'VMS' || $^O eq'MacOS' || $^O eq 'dos';
     ok( abs($diff - 3) <= 1,   "   right time (waited $diff secs for 3-sec alarm)" );
 }
+
+
+{
+    local $SIG{"ALRM"} = sub { die };
+    eval { alarm(1); my $x = qx($Perl -e sleep 3) };
+    chomp (my $foo = "foo\n");
+    ok($foo eq "foo", '[perl #33928] chomp() fails after alarm(), `sleep`');
+}