From 1d25a8c3fc3d6b8ce195ee07b23d389e67d1575e Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 9 Mar 2015 12:15:07 -0400 Subject: [PATCH] cr-ensure-disk-space: Do listing of flights on target. Signed-off-by: Ian Jackson --- cr-ensure-disk-space | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/cr-ensure-disk-space b/cr-ensure-disk-space index 6f129bd..af8efe6 100755 --- a/cr-ensure-disk-space +++ b/cr-ensure-disk-space @@ -71,11 +71,13 @@ for (;;) { last if $space >= $c{LogsMinSpaceMby}; if (!@flights) { - opendir D, "." or die $!; - $!=0; - @flights = sort { $b <=> $a } grep { m/^\d+$/ } readdir D; - die if $!; - closedir D or die $!; + open P, "-|", ontarget "ls -1 $pubdir" or die $!; + while (

) { + next unless m/^(\d+)\n$/; + push @flights, $1; + } + $!=$?=0; close P or die "ls: $? $!"; + @flights = sort { $b <=> $a } @flights; printf "(%d flights) ", scalar @flights; die unless @flights; } -- 2.39.5