From 182cbb0c69379f27cda11e695ea68bf7dc64b59c Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Wed, 23 May 2018 22:57:51 +0300 Subject: runc*: best bash practices --- %HOME%/.bash_utils/cxx.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to '%HOME%/.bash_utils') diff --git a/%HOME%/.bash_utils/cxx.sh b/%HOME%/.bash_utils/cxx.sh index d5ce371..438f798 100644 --- a/%HOME%/.bash_utils/cxx.sh +++ b/%HOME%/.bash_utils/cxx.sh @@ -117,7 +117,10 @@ runc() ( local build_dir build_dir="$( mktemp --directory )" - trap "$( printf -- 'popd > /dev/null && rm -rf -- %q' "$build_dir" )" 0 + local rm_build_dir + rm_build_dir="$( printf -- 'popd > /dev/null && rm -rf -- %q' "$build_dir" )" + + trap "$rm_build_dir" EXIT pushd "$build_dir" > /dev/null local output_name -- cgit v1.2.3