Evaluate 'script' in the global scope
authorSteve Bennett <steveb@workware.net.au>
Thu, 11 Aug 2011 02:10:54 +0000 (12:10 +1000)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Thu, 11 Aug 2011 14:20:56 +0000 (16:20 +0200)
Scripts sourced via 'script' should evaluate in the global
scope to make it easy to set and reference global variables.

Signed-off-by: Steve Bennett <steveb@workware.net.au>
src/helper/startup.tcl

index 2e2982cca6903c21bfa30b429878c96492db5272..e2ea27d0a466808ac9644ab0d5c9b70f09d0f175 100644 (file)
@@ -53,9 +53,9 @@ proc find {filename} {
 add_usage_text find "<file>"
 add_help_text find "print full path to file according to OpenOCD search rules"
 
-# Run script
+# Find and run a script
 proc script {filename} {
-       source [find $filename]
+       uplevel #0 source [find $filename]
 }
 add_help_text script "filename of OpenOCD script (tcl) to run"
 add_usage_text script "<file>"