Re: How to retrieve the output of an external program? - Mailing list pgsql-novice

From Michael Wood
Subject Re: How to retrieve the output of an external program?
Date
Msg-id CAP6d-HWiuH22=5YSshBS5rHUYH5CJ8MDQhR4q4Cd55p2WS2x0A@mail.gmail.com
Whole thread Raw
In response to How to retrieve the output of an external program?  ("Jean-Yves F. Barbier" <12ukwn@gmail.com>)
Responses Re: How to retrieve the output of an external program?  ("Jean-Yves F. Barbier" <12ukwn@gmail.com>)
List pgsql-novice
On 8 January 2012 19:29, Jean-Yves F. Barbier <12ukwn@gmail.com> wrote:
> Hi list & happy easter,

It's a bit too early for that, isn't it?  Perhaps you meant Valentine's Day? :)

> What I'd like to be able to do is:
> * Run a function that sends parms to an external pgm [no PB],
> * Capture the external pgm output that normally goes to stdout.
>
> Is it possible directly or am I obliged to use a temporary file
> and retrieve it from my function?

I'm not sure, since I've never tried something like this in Postgres,
but perhaps pipe(2), dup2(2), and one of exec*(3) will help?

I haven't read through these, but they might help too:
http://stackoverflow.com/questions/3382485/reading-child-process-output-as-soon-as-some-is-available
http://ubuntuforums.org/archive/index.php/t-1627614.html
http://stackoverflow.com/questions/3835905/redirecting-forked-process-output-to-parent-process-in-c
http://www.chemie.fu-berlin.de/chemnet/use/info/libc/libc_10.html

--
Michael Wood <esiotrot@gmail.com>

pgsql-novice by date:

Previous
From: "Jean-Yves F. Barbier"
Date:
Subject: How to retrieve the output of an external program?
Next
From: "Jean-Yves F. Barbier"
Date:
Subject: Re: How to retrieve the output of an external program?