From 3aad01ef866232e6cee9eb9fc33d156704acb235 Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Thu, 11 Dec 2014 14:37:40 +0100 Subject: [PATCH] Only one trap can be added. This prevents leakage of the /tmp/heaptrack_fifo$$ files. --- heaptrack.sh.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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" -- 2.7.4