On 10/03/12 01:23, Dave Reisner wrote:
On Fri, Mar 09, 2012 at 05:59:09PM +1000, Allan McRae wrote:
In preparation for the removal of the global error trap we need a way to ensure changing directories succeeds. Add a "cd_safe" wrapper that performs the necessary check.
Signed-off-by: Allan McRae <allan@archlinux.org> --- scripts/makepkg.sh.in | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 534f6f8..f21c638 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -874,6 +874,14 @@ error_function() { exit 2 # $E_BUILD_FAILED }
+cd_safe() { + if ! cd "$1"; then
Do we want to write stdout to /dev/null here? It _should_ be quiet since we unset CDPATH early on...
I am happy not doing that at the moment, mainly because it was never there before and I would like to know if something breaks our assumption that it should be quiet...