From 6894d4378bc36d0fbe1b89e168b9108c69ee5b41 Mon Sep 17 00:00:00 2001 From: Steve Bennett Date: Mon, 19 Jun 2023 13:33:08 +1000 Subject: 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 --- stdlib.tcl | 4 ++++ 1 file changed, 4 insertions(+) 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" } } -- cgit v1.1