hgeditor: Remove temporary files even if interrupted
authorRadoslaw "AstralStorm" Szkodzinski <astralstorm@gorzow.mm.pl>
Sun, 10 Jul 2005 16:00:49 -0800
changeset 665 40fd5722c66970942eaf019cb4ebb9a5ce92c034
parent 664 e1fbc1982372b66681a871e23e9c0370498f53e5
child 666 0100a43788cad286ab4b0cad64111bd975765ac2
push id1
push usergszorc@mozilla.com
push dateWed, 18 Mar 2015 16:34:57 +0000
hgeditor: Remove temporary files even if interrupted # HG changeset patch # User Radoslaw "AstralStorm" Szkodzinski <astralstorm@gorzow.mm.pl> # Node ID 1292f1fd015767d9682ba2ff5f8377fb6760c3a5 # Parent a4c688c8273e392b1bf33cfc736e00ec752a415e hgeditor: Remove temporary files even if interrupted Index: hg/hgeditor ===================================================================
hgeditor
--- a/hgeditor
+++ b/hgeditor
@@ -17,16 +17,18 @@ case "${EDITOR:=vi}" in
         EDITOR="$EDITOR -f -o"
         ;;
 esac
 
 if grep -q "^HG: merge resolve" "$1" ; then
     # we don't sign merges
     exec $EDITOR "$1"
 else
+    # Remove temporary files even if we get interrupted
+    trap "cleanup_exit 255" TERM KILL INT QUIT ABRT
     T1=`mktemp`; T2=`mktemp`
 
     # Add manifest hash in order to sign whole repository state.
     # Remove HG: prefix, as we want that to be stored.
     grep '^HG: manifest hash' "$1" | cut -b 5- >> "$T1"
     # Add all other state information
     grep -v '^HG: manifest hash' "$1" >> "$T1"
     (