patchShebangs: Exit if no arguments were given

Commit "patchShebangs: Allow for multiple arguments" 4a1e51f957
removed the check. We don't want to break existing usages so this
introduces it again with a successful exit code.
This commit is contained in:
Daniel Schaefer 2019-05-25 16:21:56 +02:00
parent 4a1e51f957
commit 7c3d7521f0

View File

@ -32,7 +32,7 @@ patchShebangs() {
shift
fi
header "patching script interpreter paths in $@"
echo "patching script interpreter paths in $@"
local f
local oldPath
local newPath
@ -41,6 +41,11 @@ patchShebangs() {
local oldInterpreterLine
local newInterpreterLine
if [ $# -eq 0 ]; then
echo "No arguments supplied to patchShebangs" >0
return 0
fi
local f
while IFS= read -r -d $'\0' f; do
isScript "$f" || continue
@ -61,7 +66,7 @@ patchShebangs() {
# - options: something starting with a '-'
# - environment variables: foo=bar
if $(echo "$arg0" | grep -q -- "^-.*\|.*=.*"); then
echo "$f: unsupported interpreter directive \"$oldInterpreterLine\" (set dontPatchShebangs=1 and handle shebang patching yourself)"
echo "$f: unsupported interpreter directive \"$oldInterpreterLine\" (set dontPatchShebangs=1 and handle shebang patching yourself)" >0
exit 1
fi