Skip to content

Instantly share code, notes, and snippets.

@hchbaw
Created October 20, 2010 13:18
Show Gist options
  • Save hchbaw/636381 to your computer and use it in GitHub Desktop.
Save hchbaw/636381 to your computer and use it in GitHub Desktop.
diff --git a/iex b/iex
index 8f116a1..afe7ec2 100755
--- a/iex
+++ b/iex
@@ -48,7 +48,7 @@ add_tempfiles() {
IS_REGISTERED_REMOVE_ALL_TEMPFILES="$false"
register_remove_all_tempfiles() {
$IS_REGISTERED_REMOVE_ALL_TEMPFILES || {
- trap 'remove_all_tempfiles' HUP INT QUIT TERM
+ trap 'remove_all_tempfiles' HUP INT QUIT TERM EXIT
IS_REGISTERED_REMOVE_ALL_TEMPFILES="$true"
}
}
@@ -57,7 +57,7 @@ remove_all_tempfiles() {
local x=$?
$IS_REGISTERED_REMOVE_ALL_TEMPFILES && {
for t in "${ALL_TEMPFILES[@]}"; do
- decho "cleaning up $f..."
+ decho "cleaning up $t..."
rm -f "$t"
done
}
@@ -113,6 +113,8 @@ run_file() {
local f
for f in "$@"; do
local t=`get_clone_tempfile "$f"`
+ add_tempfiles "$t"
+ decho "run_file:"${ALL_TEMPFILES[@]}
call_args=("${call_args[@]}" "$t")
done
fi
@@ -160,6 +162,8 @@ eval_code() {
files=($(get_tempfile $(cat)))
}
local script=`get_tempfile`
+ add_tempfiles "$script"
+ decho "eval_code:"${ALL_TEMPFILES[@]}
{
for l in "${EVAL_SOURCES[@]}"; do
echo "$l"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment