summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2011-01-14 20:51:59 +0000
committerPaul Buetow <paul@buetow.org>2011-01-14 20:51:59 +0000
commitfaabd703545e41350574ca0a41500d403540776f (patch)
tree819032a29bdbc3b19f94d8cc695aeee3ea731291
parent2bda59cf54ce7e1e1304ab2ed73a7ab65a0e3850 (diff)
using open insread of open2 in rem ssh command because no bi-directional pipes are needed
-rwxr-xr-xloadbars.pl7
1 files 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 ';',