Thread: pclose without waiting for child

  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    8

    pclose without waiting for child

    I'm creating a child process using popen and after a while I'm checking the result and close the pipe using pclose.

    Now the problem is that in some cases the child hasn't finished yet, so pclose will wait until the child finishes. But in this case I'm not interested in the result any more, so I don't want to wait for the child as this blocks my program.

    So my question is: Is there a way to close the pipe without waiting for the child? (so just kill the child).

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    If you want more control, then you're going to have to use fork() / execl() as previously discussed.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 11-21-2009, 01:02 AM
  2. simultaneously waiting for data on FIFO and UDP using select call
    By yogesh3073 in forum Networking/Device Communication
    Replies: 2
    Last Post: 01-05-2007, 09:53 AM
  3. Placement of pclose
    By 3saul in forum Linux Programming
    Replies: 2
    Last Post: 02-17-2006, 01:07 AM
  4. Wait loop - not busy waiting?
    By Foldager in forum Windows Programming
    Replies: 1
    Last Post: 07-17-2003, 01:39 AM