From 45afcee7098f3a3fd3f1e4ba07b53291c3cee924 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 6 Jul 2009 23:38:00 -0500 Subject: allow disabling the automatic $self->set_raw on spawn --- lib/IO/Pty/Easy.pm | 8 ++++++-- 1 file 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 -- cgit v1.2.3-54-g00ecf