Check-in [1384012f07]
Overview
SHA1:1384012f070f975065055da1a267ba5826e15b01
Date: 2014-01-25 06:57:06
User: rkeene
Comment:Updated to cleanup at any exit point
Timelines: family | ancestors | descendants | both | trunk
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
Tags And Properties
Context
2014-01-25
07:06
[e2aa9dcf13] Made smaller Tcl error (user: rkeene, tags: trunk)
06:57
[1384012f07] Updated to cleanup at any exit point (user: rkeene, tags: trunk)
06:40
[eda3d468e1] Cleaned up (user: rkeene, tags: trunk)
Changes

Modified main.tcl from [2ed373a5f2] to [ddb6656dc1].

    70     70   for {set i 0} {$i < 20} {incr i} {
    71     71   	append random_bin [format %c [expr {int(rand() * 256)}]]
    72     72   }
    73     73   binary scan $random_bin H* random
    74     74   
    75     75   set srcdir [file join $::starkit::topdir files]
    76     76   set dstdir [file join $tmpdir tcpdump-temp-$random]
           77  +
           78  +proc cleanup {} {
           79  +	# Cleanup
           80  +	catch {
           81  +		::twapi::stop_service npf
           82  +	}
           83  +	catch {
           84  +		::twapi::delete_service npf
           85  +	}
           86  +	catch {
           87  +		file delete -force -- $::dstdir
           88  +	}
           89  +}
           90  +
           91  +# Install exit handler to cleanup
           92  +rename exit _exit
           93  +proc exit args {
           94  +	cleanup
           95  +	_exit {*}$args
           96  +}
    77     97   
    78     98   # Run tcpdump
    79     99   set exit 1
    80    100   set npf_failed 0
    81    101   if {[catch {
    82    102   	## Create directory
    83    103   	file delete -force -- $dstdir