From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18305 invoked by alias); 4 Dec 2002 16:45:08 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 18297 invoked from network); 4 Dec 2002 16:45:06 -0000 Received: from unknown (HELO duracef.shout.net) (204.253.184.12) by sources.redhat.com with SMTP; 4 Dec 2002 16:45:06 -0000 Received: (from mec@localhost) by duracef.shout.net (8.11.6/8.11.6) id gB4GigY20676; Wed, 4 Dec 2002 10:44:42 -0600 Date: Wed, 04 Dec 2002 08:45:00 -0000 From: Michael Elizabeth Chastain Message-Id: <200212041644.gB4GigY20676@duracef.shout.net> To: a2782@dis.ulpgc.es Subject: Re: Pipe question Cc: gdb@sources.redhat.com X-SW-Source: 2002-12/txt/msg00076.txt.bz2 Good morning, > But when I close the program, I only write \"quit\\n\" to togdb[1]. This > causes that the program doesn\'t end properly (GDB, which is the child > process, ends well). I have to go and type \"kill\" in a console. Try running gdb directly and starting up an inferior process (child process). Then type "quit " on the command line and you will see what is happening: (gdb) quit The program is running. Exit anyway? (y or n) At this point gdb is still running and the inferior process still exists. Your program is probably closing the pipe and killing gdb at this point and that leaves the inferior process. > Could anybody tell me what instructions I have to put in the end of the > program in order to finish it succesfully (without kill)? Write a "y\n" down the pipe. Then gdb will take care of killing the inferior process. Note that gdb will ask the question only if it has an inferior process running, so your program has to parse gdb's output to see if it is asking the question. Or you may know for sure that there is always an inferior process. Or you could just slam a "y\n" down the pipe unconditionally; if gdb does not ask the question, it won't be alive to read the "y\n". But that would be crude. Hope this helps, Michael C