summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2010-04-18 17:20:06 -0500
committerJesse Luehrs <doy@tozt.net>2010-04-18 17:20:06 -0500
commitc2340699c7caea722dd43210cd8bca5fcea22a00 (patch)
tree53e77c717d1a5b94ad8cb1369f60e8ea88057f96 /lib
parent0f592e5cc31a442e282c29352082b0478c8878ab (diff)
downloadapp-termcast-c2340699c7caea722dd43210cd8bca5fcea22a00.tar.gz
app-termcast-c2340699c7caea722dd43210cd8bca5fcea22a00.zip
stop using extra_argv directly, pass command to run to the run method
Diffstat (limited to 'lib')
-rw-r--r--lib/App/Termcast.pm10
1 files changed, 4 insertions, 6 deletions
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;