From c58ee9fbcbae88329eb11c1acc08a736f5280d9d Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Tue, 11 Aug 2009 12:25:26 +1000 Subject: [PATCH] Allow users to define a batch cleanup function which is called when a batch file finishes or aborts. r2802 | ffr | 2009-08-11 12:25:26 +1000 (Tue, 11 Aug 2009) | 2 lines --- site_ansto/instrument/util/eventutil.tcl | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/site_ansto/instrument/util/eventutil.tcl b/site_ansto/instrument/util/eventutil.tcl index 441e7718..6017e1ba 100644 --- a/site_ansto/instrument/util/eventutil.tcl +++ b/site_ansto/instrument/util/eventutil.tcl @@ -52,3 +52,15 @@ proc ::event::waitfor {sobj args} { namespace import ::event::waitfor publish waitfor user + +namespace eval ::batch::call_cleanup { } +proc ::batch::cleanup {} {} +## +# @brief Calls a user defined cleanup script when a batch file ends or is aborted +# The cleanup script must be called ::batch::call_cleanup +proc ::batch::call_cleanup {} { + ::batch::cleanup + proc ::batch::cleanup {} {} +} +publish ::batch::call_cleanup user +scriptcallback connect exe BATCHEND ::batch::call_cleanup