diff options
author | Jesse Luehrs <doy@tozt.net> | 2012-03-05 00:36:07 -0600 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2012-03-05 00:36:07 -0600 |
commit | f37b732fa2a9f4c4e31c602fb3309bc882400ab9 (patch) | |
tree | 1f3c7a1cf99b494ac39f8ac28d9ae041e3806418 /t/system.t | |
parent | 4e21bde42072a32e0a7cc515546ce9f13ecc8833 (diff) | |
download | io-pty-easy-f37b732fa2a9f4c4e31c602fb3309bc882400ab9.tar.gz io-pty-easy-f37b732fa2a9f4c4e31c602fb3309bc882400ab9.zip |
cleanups, dzil stuff, etc
Diffstat (limited to 't/system.t')
-rw-r--r-- | t/system.t | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/t/system.t b/t/system.t new file mode 100644 index 0000000..c6fb29e --- /dev/null +++ b/t/system.t @@ -0,0 +1,30 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; +use IO::Pty::Easy; + +my $pty = IO::Pty::Easy->new; +$pty->spawn("$^X -ple ''"); +my $output; +eval { + local $SIG{ALRM} = sub { die "alarm\n" }; + alarm 5; + $output = `$^X -e 'print "foo"'`; + alarm 0; +}; +isnt($@, "alarm\n", "system() didn't time out"); +is($output, "foo", "system() got the right value"); +$pty->kill; +undef $output; +eval { + local $SIG{ALRM} = sub { die "alarm2\n" }; + alarm 5; + $output = `$^X -e 'print "bar"'`; + alarm 0; +}; +isnt($@, "alarm2\n", "system() didn't time out (after kill)"); +is($output, "bar", "system() got the right value (after kill)"); +$pty->close; + +done_testing; |