summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjluehrs2 <jluehrs2@uiuc.edu>2007-08-16 21:23:11 -0500
committerjluehrs2 <jluehrs2@uiuc.edu>2007-08-16 21:23:11 -0500
commit9864508d5692d6f4c5e1d358281eb4842c23f77b (patch)
tree0abb3a4b85ccf339adc50d0e54f3f7da8c120193
parent8aaf59ce913817a4540dd7cbfa201e3c7098235c (diff)
downloadio-pty-easy-9864508d5692d6f4c5e1d358281eb4842c23f77b.tar.gz
io-pty-easy-9864508d5692d6f4c5e1d358281eb4842c23f77b.zip
we don't need to explicitly specify a max for writing, since we can use the string length
-rw-r--r--lib/IO/Pty/Easy.pm6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/IO/Pty/Easy.pm b/lib/IO/Pty/Easy.pm
index cea796b..f6049c2 100644
--- a/lib/IO/Pty/Easy.pm
+++ b/lib/IO/Pty/Easy.pm
@@ -74,7 +74,6 @@ sub new {
# options
handle_pty_size => 1,
def_max_read_chars => 8192,
- def_max_write_chars => 8192,
@_,
# state
@@ -218,15 +217,14 @@ Returns undef on timeout, 0 on failure to write (including if no subprocess is r
sub write {
my $self = shift;
return 0 unless $self->is_active;
- my ($text, $timeout, $max_chars) = @_;
- $max_chars ||= $self->{def_max_write_chars};
+ my ($text, $timeout) = @_;
my $win = '';
vec($win, fileno($self->{pty}), 1) = 1;
my $nfound = select(undef, $win, undef, $timeout);
my $nchars;
if ($nfound > 0) {
- $nchars = syswrite($self->{pty}, $text, $max_chars);
+ $nchars = syswrite($self->{pty}, $text, length $text);
}
return $nchars;
}