summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2012-03-05 02:19:59 -0600
committerJesse Luehrs <doy@tozt.net>2012-03-05 02:19:59 -0600
commitb3f1bda4fc4015d1fef9e6ba07e5340b7b41308c (patch)
tree91d9ef8e839bb9e341422e6bfb86fd9ffb14956f
parent906c4ab3946a60af6b843529c67da272bebdd95e (diff)
downloadterm-filter-b3f1bda4fc4015d1fef9e6ba07e5340b7b41308c.tar.gz
term-filter-b3f1bda4fc4015d1fef9e6ba07e5340b7b41308c.zip
this doesn't really make sense if stdin/stdout aren't attached to a tty
-rw-r--r--lib/Term/Filter.pm3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Term/Filter.pm b/lib/Term/Filter.pm
index 9969895..9172fc2 100644
--- a/lib/Term/Filter.pm
+++ b/lib/Term/Filter.pm
@@ -149,6 +149,9 @@ sub _setup {
my $self = shift;
my (@cmd) = @_;
+ Carp::croak("Must be run attached to a tty")
+ unless -t $self->input && -t $self->output;
+
$self->pty->spawn(@cmd) || Carp::croak("Couldn't spawn @cmd: $!");
$self->_raw_mode(1);