summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2009-07-06 23:38:00 -0500
committerJesse Luehrs <doy@tozt.net>2009-07-06 23:38:00 -0500
commit45afcee7098f3a3fd3f1e4ba07b53291c3cee924 (patch)
treeb0bdac5bdec80465008d456d1d52ea50d213317e
parent09d9f7aa14f50d03d6f207b9da6b325c5b99cbfd (diff)
downloadio-pty-easy-45afcee7098f3a3fd3f1e4ba07b53291c3cee924.tar.gz
io-pty-easy-45afcee7098f3a3fd3f1e4ba07b53291c3cee924.zip
allow disabling the automatic $self->set_raw on spawn
-rw-r--r--lib/IO/Pty/Easy.pm8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/IO/Pty/Easy.pm b/lib/IO/Pty/Easy.pm
index 1d74f59..847ede7 100644
--- a/lib/IO/Pty/Easy.pm
+++ b/lib/IO/Pty/Easy.pm
@@ -84,11 +84,15 @@ sub new {
my $def_max_read_chars = 8192;
$def_max_read_chars = delete $args{def_max_read_chars}
if exists $args{def_max_read_chars};
+ my $raw = 1;
+ $raw = delete $args{raw}
+ if exists $args{raw};
my $self = $class->SUPER::new(%args);
bless $self, $class;
$self->handle_pty_size($handle_pty_size);
$self->def_max_read_chars($def_max_read_chars);
+ ${*{$self}}{io_pty_easy_raw} = $raw;
${*{$self}}{io_pty_easy_final_output} = '';
return $self;
@@ -135,7 +139,7 @@ sub spawn {
$self->make_slave_controlling_terminal;
close $self;
$slave->clone_winsize_from(\*STDIN) if $self->handle_pty_size;
- $slave->set_raw;
+ $slave->set_raw if ${*{$self}}{io_pty_easy_raw};
# reopen the standard file descriptors in the child to point to the
# pty rather than wherever they have been pointing during the script's
# execution
@@ -154,7 +158,7 @@ sub spawn {
close $writep;
$self->close_slave;
- $self->set_raw;
+ $self->set_raw if ${*{$self}}{io_pty_easy_raw};
# this sysread will block until either we get an EOF from the other end of
# the pipe being closed due to the exec, or until the child process sends
# us the errno of the exec call after it fails