From: Milian Wolff Date: Thu, 11 Dec 2014 13:37:40 +0000 (+0100) Subject: Only one trap can be added. X-Git-Tag: submit/tizen/20180620.112952^2~363 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3aad01ef866232e6cee9eb9fc33d156704acb235;p=sdk%2Ftools%2Fheaptrack.git Only one trap can be added. This prevents leakage of the /tmp/heaptrack_fifo$$ files. --- diff --git a/heaptrack.sh.cmake b/heaptrack.sh.cmake index eb54fa9..0a4d469 100755 --- a/heaptrack.sh.cmake +++ b/heaptrack.sh.cmake @@ -130,13 +130,17 @@ LIBHEAPTRACK_INJECT=$(readlink -f "$LIBHEAPTRACK_INJECT") # setup named pipe to read data from pipe=/tmp/heaptrack_fifo$$ mkfifo $pipe -trap "rm -f $pipe" EXIT # interpret the data and compress the output on the fly output="$output.gz" "$INTERPRETER" < $pipe | gzip -c > "$output" & debuggee=$! -trap "kill $debuggee 2> /dev/null" EXIT + +function cleanup { + rm -f "$pipe" + kill "$debuggee" 2> /dev/null +} +trap cleanup EXIT echo "starting application, this might take some time..." echo "output will be written to $output"