forked from mirrors/nixpkgs
makeWrapper: fix flag handling
When `--add-flags` is not used, `flagsBefore` is unset. This causes an error when invoking `makeWrapper` from a context that sets `-o nounset`, as is done in `buildDotnetModule`. This change makes `makeWrapper` safe for use in these conditions.
This commit is contained in:
parent
4e6190bec3
commit
40fbc97988
|
@ -166,11 +166,11 @@ makeShellWrapper() {
|
||||||
elif [[ "$p" == "--add-flags" ]]; then
|
elif [[ "$p" == "--add-flags" ]]; then
|
||||||
flags="${params[$((n + 1))]}"
|
flags="${params[$((n + 1))]}"
|
||||||
n=$((n + 1))
|
n=$((n + 1))
|
||||||
flagsBefore="$flagsBefore $flags"
|
flagsBefore="${flagsBefore-} $flags"
|
||||||
elif [[ "$p" == "--append-flags" ]]; then
|
elif [[ "$p" == "--append-flags" ]]; then
|
||||||
flags="${params[$((n + 1))]}"
|
flags="${params[$((n + 1))]}"
|
||||||
n=$((n + 1))
|
n=$((n + 1))
|
||||||
flagsAfter="$flagsAfter $flags"
|
flagsAfter="${flagsAfter-} $flags"
|
||||||
elif [[ "$p" == "--argv0" ]]; then
|
elif [[ "$p" == "--argv0" ]]; then
|
||||||
argv0="${params[$((n + 1))]}"
|
argv0="${params[$((n + 1))]}"
|
||||||
n=$((n + 1))
|
n=$((n + 1))
|
||||||
|
@ -183,7 +183,7 @@ makeShellWrapper() {
|
||||||
done
|
done
|
||||||
|
|
||||||
echo exec ${argv0:+-a \"$argv0\"} \""$original"\" \
|
echo exec ${argv0:+-a \"$argv0\"} \""$original"\" \
|
||||||
"$flagsBefore" '"$@"' "$flagsAfter" >> "$wrapper"
|
"${flagsBefore-}" '"$@"' "${flagsAfter-}" >> "$wrapper"
|
||||||
|
|
||||||
chmod +x "$wrapper"
|
chmod +x "$wrapper"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue