Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Need to force Tcl prompt even if not run from a tty.

Closed / Invalid218019ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 00:52:15
OriginalBugID: 1127 RFE
Version: 8.0.4
SubmitDate: '1999-01-29'
LastModified: '2000-05-10'
Severity: MED
Status: Closed
Submitter: welch
ChangedBy: hobbs
OS: Solaris
OSVersion: 5.6
Machine: Other
FixedDate: '2000-10-25'
ClosedDate: '2000-05-10'


Name:

Krzysztof Kozminski


Extensions:

Too many to list


DesiredBehavior:

I need to force Tcl to believe that it is being run interactively, even though it is really being run from a pipe spawned by another program.  This other program (a product of a major CAD software vendor) has really clunky communication facility (no scriptable sockets, just pipes), and the Tcl prompt is the easiest way to let the other program know that my interpreter is ready to accept commands.


Patch:

diff --ignore-matching-lines=$Id: --ignore-matching-lines=$Source: --ignore-matching-lines=$Header: --ignore-matching-lines=$Date: --ignore-matching-lines=$Author: --ignore-matching-lines=$Revision: -c -r1.1 proWrapTclMain.c

*** proWrapTclMain.c    1999/01/26 07:22:53 1.1

--- proWrapTclMain.c    1999/01/26 07:29:24

***************

*** 196,201 ****

--- 196,203 ----

    Tcl_DeleteInterp(interp);

    Tcl_Exit(1);

      }

+ 

+     tty = strcmp(Tcl_GetVar(interp, "tcl_interactive", TCL_GLOBAL_ONLY), "0");


      /*

       * If a script file was specified then just source that file

diff --ignore-matching-lines=$Id: --ignore-matching-lines=$Source: --ignore-matching-lines=$Header: --ignore-matching-lines=$Date: --ignore-matching-lines=$Author: --ignore-matching-lines=$Revision: -c -r1.1 proWrapTkMain.c

*** proWrapTkMain.c 1999/01/25 21:23:44 1.1

--- proWrapTkMain.c 1999/01/26 21:07:40

***************

*** 210,218 ****

--- 210,221 ----


      if ((*appInitProc)(interp) != TCL_OK) {

    TkpDisplayWarning(interp->result, "Application initialization failed");

+   Tcl_Eval(interp, "puts stderr $errorInfo");

    Tcl_DeleteInterp(interp);

    Tcl_Exit(1);

      }

+ 

+     tty = strcmp(Tcl_GetVar(interp, "tcl_interactive", TCL_GLOBAL_ONLY), "0");


      /*

       * Invoke the script specified on the command line, if any.


PatchFiles:

proWrapTclMain.c

proWrapTkMain.c




All that this patch does is to enable user's appInitProc to reset the tcl_interactive variable to 1.

Seems to work, although I was not at all sure whether changing this variable after Pro_WrapInit(interp) was a healthy idea.

--
All this can be done at the tcl level by setting tcl_interactive
and creating a simulated event loop handling. 
-- 05/10/2000 hobbs
welch Closed ticket [218019ffff]. [History diff]2000-10-26 08:12:12
dgp Ticket [218019ffff]: 4 changes [History diff]2001-04-16 23:50:36
Log in (anonymous is fine) to add a comment.