Tcl_Interp *ip; /* valid, non-0 and useable if set */
Tcl_Obj *obj; /* non-0 iff set (but only test for 0/non-0) */
Tcl_Obj *xargs;
- int llength;
+ int llength; /* after set, is llength of script + xargs */
} ScriptToInvoke;
void cht_scriptinv_init(ScriptToInvoke *si);
void cht_scriptinv_cancel(ScriptToInvoke *si); /* then don't invoke */
/* no separate free function - just cancel */
+int cht_scriptinv_invoke_fg(ScriptToInvoke *si, int argc,
+ Tcl_Obj *const *argv);
+ /* if script fails, returns that error */
+
void cht_scriptinv_invoke(ScriptToInvoke *si, int argc, Tcl_Obj *const *argv);
+ /* if script fails, reports it with Tcl_BackgroundError */
/* from idtable.c */
return 0;
}
-void cht_scriptinv_invoke(ScriptToInvoke *si, int argc, Tcl_Obj *const *argv) {
+int cht_scriptinv_invoke_fg(ScriptToInvoke *si, int argc,
+ Tcl_Obj *const *argv) {
Tcl_Obj *invoke=0;
int i, rc;
x_rc:
for (i=0; i<argc; i++) Tcl_DecrRefCount(argv[i]);
if (invoke) Tcl_DecrRefCount(invoke);
- if (rc) Tcl_BackgroundError(si->ip);
+ return rc;
}
+
+void cht_scriptinv_invoke(ScriptToInvoke *si, int argc, Tcl_Obj *const *argv) {
+ rc= cht_scriptinv_invoke_fg(si, argc, argv);
+ if (rc) Tcl_BackgroundError(si->ip);
+}