From faabd703545e41350574ca0a41500d403540776f Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 14 Jan 2011 20:51:59 +0000 Subject: using open insread of open2 in rem ssh command because no bi-directional pipes are needed --- loadbars.pl | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/loadbars.pl b/loadbars.pl index 7eff6b9..b9f16cf 100755 --- a/loadbars.pl +++ b/loadbars.pl @@ -32,8 +32,6 @@ use strict; use warnings; -use IPC::Open2; - use Getopt::Long; use Term::ReadLine; @@ -138,7 +136,7 @@ BASH my $cmd = $host eq 'localhost' ? $bash : "ssh -o StrictHostKeyChecking=no $CONF{sshopts} $host '$bash'"; - my $pid = open2 my $out, my $in, $cmd or do { + my $pid = open my $pipe, "$cmd |" or do { say "Warning: $!"; return; }; @@ -146,6 +144,7 @@ BASH $SIG{STOP} = sub { say "Shutting down get_stat($host) & PID $pid"; kill 1, $pid; + close $pipe; threads->exit(); }; @@ -156,7 +155,7 @@ BASH my $cpuregexp = qr/$CONF{cpuregexp}/; - while (<$out>) { + while (<$pipe>) { /$cpuregexp/ && do { my ($name, $load) = parse_cpu_line $_; $STATS{"$host;$name"} = join ';', -- cgit v1.2.3