+proc run {what command args} {
+ ## Run a command, reporting the result. WHAT is shown in the output;
+ ## COMMAND are the command and arguments as a list; these are substituted
+ ## according to the string map ARGS. Return true if the command succeeded,
+ ## false if it failed.
+
+ global QUIS
+
+ ## Substitute tokens in the command.
+ set cmd {}
+ set subst [concat [list "%%" "%"] $args]
+ foreach item $command { lappend cmd [string map $subst $item] }
+
+ ## Run the command.
+ set rc [catch {
+ set out [eval exec -ignorestderr $cmd 2>@1]
+ } msg]
+
+ ## Sort out the report.
+ if {$rc} { set out $msg }
+ set out "| [string map [list "\n" "\n| "] $out]"
+
+ ## Announce the result.
+ if {$rc} {
+ puts stderr "$QUIS: $what failed..."
+ puts stderr $out
+ return false
+ } else {
+ puts "$QUIS: $what output..."
+ puts $out
+ return true
+ }
+}
+