Skip to content

Commit 9eab777

Browse files
authored
Merge pull request #2701 from Pinata-Consulting/logging-stringly-typed-fix
logging: stringly typed fixes
2 parents 973317c + dbb2291 commit 9eab777

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

flow/scripts/util.tcl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
proc log_cmd {cmd args} {
22
# log the command, escape arguments with spaces
3-
puts -nonewline "$cmd[join [lmap arg $args {expr {[string match {* *} $arg] ? " \"$arg\"" : " $arg"}}] ""]"
3+
set log_cmd "$cmd[join [lmap arg $args {format " %s" [expr {[string match {* *} $arg] ? "\"$arg\"" : "$arg"}]}] ""]"
4+
puts $log_cmd
45
set start [clock seconds]
56
$cmd {*}$args
67
set time [expr {[clock seconds] - $start}]
78
if {$time >= 5} {
8-
puts -nonewline " ($time seconds)"
9+
# Ideally we'd use a single line, but the command can output text
10+
# and we don't want to mix it with the log, so output the time it took afterwards.
11+
puts "Took $time seconds: $log_cmd"
912
}
1013
puts ""
1114
}

0 commit comments

Comments
 (0)