From 9217deeff0cae350ee86200e89bf25adb29bf991 Mon Sep 17 00:00:00 2001 From: doy Date: Tue, 3 Feb 2009 22:46:15 -0500 Subject: a few minor cleanups --- lib/IO/Pty/Easy.pm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/IO/Pty/Easy.pm b/lib/IO/Pty/Easy.pm index 644b1da..8ec03fe 100644 --- a/lib/IO/Pty/Easy.pm +++ b/lib/IO/Pty/Easy.pm @@ -82,8 +82,9 @@ sub new { @_, # state - pty => undef, - pid => undef, + pty => undef, + pid => undef, + final_output => '', }; bless $self, $class; @@ -155,7 +156,6 @@ sub spawn { close $writep; $self->{pty}->close_slave; $self->{pty}->set_raw; - $self->{final_output} = ''; # 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 @@ -256,14 +256,14 @@ sub is_active { my $self = shift; return 0 unless defined $self->{pid}; - # XXX XXX XXX FreeBSD 7.0 will not allow a session leader to exit - # until the kernel tty output buffer is empty. Make it so. + # XXX FreeBSD 7.0 will not allow a session leader to exit until the kernel + # tty output buffer is empty. Make it so. my $rin = ''; vec($rin, fileno($self->{pty}), 1) = 1; my $nfound = select($rin, undef, undef, 0); if ($nfound > 0) { - sysread($self->{pty}, $self->{final_output}, - $self->{def_max_read_chars}, length $self->{final_output}); + sysread($self->{pty}, $self->{final_output}, + $self->{def_max_read_chars}, length $self->{final_output}); } my $active = kill 0 => $self->{pid}; -- cgit v1.2.3-54-g00ecf