eutils.eclass: make_wrapper, fix 'cd' error handling

Reorder the generated wrapper, and add '&&' after the 'cd' call so that
the wrapper will not try to execute the program if 'cd' command fails.
This commit is contained in:
Michał Górny
2018-06-22 10:42:03 +02:00
parent 24bed508c5
commit bef50010a4

View File

@@ -148,7 +148,6 @@ make_wrapper() {
(
echo '#!/bin/sh'
[[ -n ${chdir} ]] && printf 'cd "%s"\n' "${EPREFIX}${chdir}"
if [[ -n ${libdir} ]] ; then
local var
if [[ ${CHOST} == *-darwin* ]] ; then
@@ -164,6 +163,7 @@ make_wrapper() {
fi
EOF
fi
[[ -n ${chdir} ]] && printf 'cd "%s" &&\n' "${EPREFIX}${chdir}"
# We don't want to quote ${bin} so that people can pass complex
# things as ${bin} ... "./someprog --args"
printf 'exec %s "$@"\n' "${bin/#\//${EPREFIX}/}"