Skip to content

Commit a228f25

Browse files
committed
ENH: Fix processing of negative values to avoid awk bug
awk would have '--' which is a special symbol when the values were negative
1 parent 4e379a0 commit a228f25

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

action.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,13 @@ runs:
141141
formatByteCount() {
142142
bytes=$1
143143
if [ "$bytes" -lt "0" ]; then
144-
kilobytes=$(awk "BEGIN {printf \"%.2f\", -$1 * 1000}")
144+
kilobytes=$(awk "BEGIN {printf \"%.2f\", $1 * -1000}")
145+
sign_symbol="-"
145146
else
146147
kilobytes=$(awk "BEGIN {printf \"%.2f\", $1 * 1000}")
148+
sign_symbol="+"
147149
fi
148-
echo $(numfmt --to=iec-i --suffix=B --padding=7 ${kilobytes});
150+
echo ${sign_symbol}$(numfmt --to=iec-i --suffix=B --padding=7 ${kilobytes});
149151
}
150152
151153
# macro to output saved space

0 commit comments

Comments
 (0)