Skip to content

Commit 6829f4c

Browse files
authored
Update check_spdx.sh to return 1 on failure (#4277)
1 parent 286523c commit 6829f4c

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

scapy/tools/check_spdx.sh

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,23 @@
99
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
1010
ROOT_DIR=$SCRIPT_DIR/../..
1111

12+
# http://mywiki.wooledge.org/BashFAQ/024
13+
# This documents an absolutely WTF behavior of bash.
14+
set +m
15+
shopt -s lastpipe
16+
1217
function check_path() {
1318
cd $ROOT_DIR
19+
RCODE=0
1420
for ext in "${@:2}"; do
15-
find $1 -name "*.$ext" -exec bash -c '[[ -z $(grep "SPDX" {}) ]] && echo "{}"' \;
21+
find $1 -name "*.$ext" | while read f; do
22+
if [[ -z $(grep "SPDX" $f) ]]; then
23+
echo "$f"
24+
RCODE=1
25+
fi
26+
done
1627
done
28+
return $RCODE
1729
}
1830

19-
check_path scapy py
31+
check_path scapy py || exit $?

0 commit comments

Comments
 (0)