Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6102983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:40:36+00:00 2026-05-23T13:40:36+00:00

I’m currently wrapping a command line tool ( espeak ) with Tcl/Tk, and I

  • 0

I’m currently wrapping a command line tool (espeak) with Tcl/Tk, and I have figured this out so far:

load ./extensions/system.so
package require Tk
package require Tclx

set chid 0

proc kill {id} {
    exec kill -9 $id
}

proc speak {} {
    global chid
    set chid [fork]
    if {$chid == 0} {
        execvp espeak [.text get 1.0 end]
    }
}

proc silent {} {
    global chid
    kill $chid
}

Where system.so is an extension I hacked together to be able to use execvp:

#include <tcl.h>
#include <tclExtend.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

static int 
execvp_command(ClientData cdata, Tcl_Interp *interp, int argc, const char* argv[])
{   
    if (argc == 1)
    {
        interp->result = "execvp command ?args ...?";
        return TCL_ERROR;
    }

    execvp(argv[1], argv + 1);

    return TCL_OK;
}

int System_Init(Tcl_Interp* interp)
{
    if (Tcl_InitStubs(interp, "8.1", 0) == NULL)
        return TCL_ERROR;

    Tcl_CreateCommand(interp, "execvp", execvp_command, NULL, NULL);

    Tcl_PkgProvide(interp, "system", "1.0");

    return TCL_OK;
}

The reason I need execvp is because a subprocess created by exec (Tcl) seems to keep going when the process dies (I can confirm this by ^C‘ing out of the GUI), whereas if I use execvp, espeak dies properly.

Thus, all I really need out of this script is to be able to start a subprocess and kill it on demand.

Is there another library that can do this properly, like Expect?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:40:37+00:00Added an answer on May 23, 2026 at 1:40 pm

    Tcl uses execvp internally (really; I’ve just checked the source) so the difference lies elsewhere. That elsewhere will be in signals; the subprocess created by the exec command (and other things that use the same underlying engine) will have the majority of signals forced to use the default signal handlers, but since the only signal it sets to non-default is SIGPIPE, I wonder what else is going on.

    That said, the definitive extension for working with this sort of thing is TclX. That gives you access to all the low-level POSIX functionality that you’ve been using partially. (Expect may also be able to do it.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have some data like this: 1 2 3 4 5 9 2 6
I am currently running into a problem where an element is coming back from
I want use html5's new tag to play a wav file (currently only supported
I have a JSP page retrieving data and when single or double quotes are
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.