From c2340699c7caea722dd43210cd8bca5fcea22a00 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sun, 18 Apr 2010 17:20:06 -0500 Subject: stop using extra_argv directly, pass command to run to the run method --- lib/App/Termcast.pm | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/App/Termcast.pm b/lib/App/Termcast.pm index bc0ff94..e0e2ec9 100644 --- a/lib/App/Termcast.pm +++ b/lib/App/Termcast.pm @@ -101,12 +101,7 @@ has pty => ( ); sub _build_pty { - my $self = shift; - my @argv = @{ $self->extra_argv }; - push @argv, ($ENV{SHELL} || '/bin/sh') if !@argv; - my $pty = IO::Pty::Easy->new(raw => 0); - $pty->spawn(@argv); - return $pty; + IO::Pty::Easy->new(raw => 0); } sub _build_select_args { @@ -168,10 +163,13 @@ sub write_to_termcast { sub run { my $self = shift; + my @cmd = @_; ReadMode 5; my $guard = Scope::Guard->new(sub { ReadMode 0 }); + $self->pty->spawn(@cmd) || die "Couldn't spawn @cmd: $!"; + local $SIG{WINCH} = sub { $self->_got_winch(1) }; while (1) { my ($rin, $win, $ein) = $self->_build_select_args; -- cgit v1.2.3-54-g00ecf