Skip to content

Commit 69be3a2

Browse files
authored
Avoid early exit in check/shellcheck due to spurious read failure (#1150)
Problem: In bash `read -r -d "" VAR` expects a NUL character to terminate the input line. If missing read returns a failure exit status and thus quits the shellcheck script due to its errexit option. Solution: Terminate read input with the NUL character.
1 parent 00419ab commit 69be3a2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

check/shellcheck

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,12 @@ for arg in "$@"; do
4343
done
4444

4545
# Find all shell scripts in this repository.
46-
IFS=$'\n' read -r -d '' -a our_shell_scripts <<< "$(
46+
IFS=$'\n' read -r -d "" -a our_shell_scripts < <(
4747
git ls-files -z -- \
48-
':(exclude)*.'{hdf5,ipynb,json,md,py,rst,toml,ts,txt,yaml} | \
49-
xargs -0 file | grep -i 'shell script' | cut -d: -f1
50-
)"
48+
':(exclude)*.'{hdf5,ipynb,json,md,py,rst,toml,ts,txt,yaml} |
49+
xargs -0 file | grep -i 'shell script' | cut -d: -f1;
50+
printf "\0"
51+
)
5152

5253
# Verify our_shell_scripts array - require it must contain files below.
5354
declare -a required_shell_scripts

0 commit comments

Comments
 (0)