summaryrefslogtreecommitdiffstats
path: root/t/002-spawn.t
diff options
context:
space:
mode:
Diffstat (limited to 't/002-spawn.t')
-rw-r--r--t/002-spawn.t22
1 files changed, 22 insertions, 0 deletions
diff --git a/t/002-spawn.t b/t/002-spawn.t
new file mode 100644
index 0000000..9b61437
--- /dev/null
+++ b/t/002-spawn.t
@@ -0,0 +1,22 @@
+#!perl
+use strict;
+use warnings;
+use Test::More tests => 5;
+use IO::Pty::Easy;
+
+my $pty = new IO::Pty::Easy;
+$pty->spawn("$^X -ple ''");
+ok($pty->is_active, "spawning a subprocess");
+ok(kill(0 => $pty->{pid}), "subprocess actually exists");
+$pty->kill;
+TODO: {
+local $TODO = "kill() needs to block";
+ok(!$pty->is_active, "killing a subprocess");
+}
+$pty->spawn("$^X -ple ''");
+$pty->close;
+TODO: {
+local $TODO = "kill() needs to block";
+ok(!$pty->is_active, "auto-killing a pty with close()");
+}
+ok(!defined($pty->{pty}), "closing a pty after a spawn");