diff mbox

[v4,12/16] osstest: allow catching-otherwise to pass arguments to the called script

Message ID 20170706144227.36580-13-roger.pau@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Roger Pau Monne July 6, 2017, 2:42 p.m. UTC
Allow catching-otherwise to take a variable number of tail arguments,
that will be propagated to the called proc.

Signed-off-by: Roger Pau Monné <roger.pua@citrix.com>
---
Changes since v3:
 - New in this version.
---
 sg-run-job | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Ian Jackson July 6, 2017, 3:33 p.m. UTC | #1
Roger Pau Monne writes ("[PATCH v4 12/16] osstest: allow catching-otherwise to pass arguments to the called script"):
> Allow catching-otherwise to take a variable number of tail arguments,
> that will be propagated to the called proc.

Err, this is not necessary, I think.  The caller can do it.

Let me see how you use it...

... indeed.  I will reply to those patches.

Ian.
diff mbox

Patch

diff --git a/sg-run-job b/sg-run-job
index b1f94f4d..87d81085 100755
--- a/sg-run-job
+++ b/sg-run-job
@@ -123,8 +123,8 @@  proc run-job {job} {
     }
 }
 
-proc catching-otherwise {failst script} {
-    # Executes $script.
+proc catching-otherwise {failst script args} {
+    # Executes $script $args.
     # If job is already a failure (ie not $ok), skips it (ie does nothing).
     # If any Tcl exception is thrown, declares the job a failure.
     # (ie sets job status to $failst, and sets ok to 0)
@@ -134,9 +134,9 @@  proc catching-otherwise {failst script} {
     if {!$ok} return
 
     if {[catch {
-        uplevel 1 $script
+        uplevel 1 $script $args
     } emsg]} {
-        jobdb::logputs stderr "$flight.$jobinfo(job) $script failed: $emsg"
+        jobdb::logputs stderr "$flight.$jobinfo(job) $script $args failed: $emsg"
         set ok 0
 	setstatus $failst
     }