aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2023-06-19 13:33:08 +1000
committerSteve Bennett <steveb@workware.net.au>2023-06-21 18:46:13 +1000
commit6894d4378bc36d0fbe1b89e168b9108c69ee5b41 (patch)
treeb0a8bd6865dd899a58d87e345dc4781f3ea5335a
parente6ce71c939700b9d550bbf907993196ea3aae7b0 (diff)
downloadjimtcl-6894d4378bc36d0fbe1b89e168b9108c69ee5b41.zip
jimtcl-6894d4378bc36d0fbe1b89e168b9108c69ee5b41.tar.gz
jimtcl-6894d4378bc36d0fbe1b89e168b9108c69ee5b41.tar.bz2
stackdump: truncate command at first newline
Often the command in a stack trace will be a long script. This makes it hard to read the stacktrace, so in this case truncate at the first newline and add ... Signed-off-by: Steve Bennett <steveb@workware.net.au>
-rw-r--r--stdlib.tcl4
1 files changed, 4 insertions, 0 deletions
diff --git a/stdlib.tcl b/stdlib.tcl
index 289acbf..cf97d3c 100644
--- a/stdlib.tcl
+++ b/stdlib.tcl
@@ -48,6 +48,10 @@ proc stackdump {stacktrace} {
if {$line ne ""} {
lappend lines $line
if {$cmd ne ""} {
+ set nl [string first \n $cmd 1]
+ if {$nl >= 0} {
+ set cmd [string range $cmd 0 $nl-1]...
+ }
lappend lines " $cmd"
}
}