From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,1a7be6e64c98018a X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news1.google.com!news3.google.com!news2.google.com!proxad.net!proxad.net!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Spawn : Get the output of the called program Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.14.1 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: Date: Wed, 6 Apr 2005 17:13:35 +0200 Message-ID: NNTP-Posting-Date: 06 Apr 2005 17:13:35 MEST NNTP-Posting-Host: 5e9a2653.newsread2.arcor-online.net X-Trace: DXC=[U=U96_4nlaCUhGd:LVK2eQ5U85hF6f;djW\KbG]kaMh]kI_X=5Keaf30<;KdZlH6m[6LHn;2LCVn7enW;^6ZC`d<=9bOTW=MNn X-Complaints-To: abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:10306 Date: 2005-04-06T17:13:35+02:00 List-Id: On Wed, 06 Apr 2005 16:43:31 +0200, Jean-Baptiste CAMPESATO wrote: > Le Wed, 06 Apr 2005 12:21:14 +0200, Jean-Baptiste CAMPESATO a �crit�: > >> I want to called a programm (like the Spawn Procedure in GNAT.OS_lib) but >> i wannt to get the output fo this program. >> Do you know how can i get the output with Spawn, or another >> function/procedure to do that ? >> Thanks > > Thanks everybody :). > I will read http://adacl.sourceforge.net/ and a doc about pipes. I don't like the design of either library because many programs heavily use stderr. For them to make it useful one needs all three pipes. Further, the stderr pipe should be read out asynchronously from a parallel task. Otherwise, you are risking to fall into a deadlock if the pipe buffer size is limited, which is often the case. Therefore, you need two procedures: Spawn to invoke the program and Wait to wait for its completion. Then when you read from the stdout take care about End_Error. Normally after End_Error, you just call Wait. Also the procedure Wait should raise an exception if stderr was not empty. P.S. We have implemented it for Unix/Posix with no GNAT.OS_lib, but alas it is proprietary. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de