<div dir="ltr"><div>My use case right now is calling an OS command from my FORTH dialect, but a while back I wrote some code that binds to libCurl and chucks the response back into a string, I will probably use that code as well as I have some words to implement; GET PUT POST DELETE OPTIONS.</div><div><br></div><div>I like your idea for a predicate as proposed but it might be YAGNI across a wider audience i.e. if it was that much of an in-demand feature I suspect it would already be available. Maybe! :D</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, 31 Aug 2024 at 17:48, Volker Wysk <<a href="mailto:post@volker-wysk.de">post@volker-wysk.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi there<br>
<br>
Actually, I've been toying with the idea of writing something like this:<br>
<br>
:- pred run_program(<br>
string::in, % Path to executable<br>
bool::in, % Connect stdin?<br>
bool::in, % Connect stdout?<br>
bool::in, % Connect stderr?<br>
maybe(io.text_output_stream)::out, % Handle to program's stdin<br>
maybe(io.text_input_stream)::out, % Handle to program's stdout<br>
maybe(io.text_input_stream)::out, % Handle to program's stderr<br>
int::out % Child process's process id<br>
) is det.<br>
<br>
For this to work, a predicate for attaching a stream to an existing file<br>
descriptor would be needed. It doesn't look like this is provided by the<br>
io/io.call_system libraries.<br>
<br>
I would be inclined to contribute this to the standard libraries, if that is<br>
welcome. I know that a high code quality would be required.<br>
<br>
Cheers<br>
Volker<br>
<br>
<br>
Am Samstag, dem 31.08.2024 um 16:35 +0200 schrieb Zoltan Somogyi:<br>
> <br>
> <br>
> On Sat, 31 Aug 2024 15:30:30 +0100, emacstheviking <<a href="mailto:objitsu@gmail.com" target="_blank">objitsu@gmail.com</a>><br>
> wrote:<br>
> > I have been reading io.system_call and cannot see how to capture the<br>
> > output<br>
> > into a string... was this ever possible?<br>
> <br>
> Assuming you are talking about io.call_system, the answer is "no".<br>
> <br>
> > Do I have pipe to a file myself then, then read and process the contents<br>
> > thus generated?<br>
> <br>
> Yes.<br>
> <br>
> Zoltan.<br>
_______________________________________________<br>
users mailing list<br>
<a href="mailto:users@lists.mercurylang.org" target="_blank">users@lists.mercurylang.org</a><br>
<a href="https://lists.mercurylang.org/listinfo/users" rel="noreferrer" target="_blank">https://lists.mercurylang.org/listinfo/users</a><br>
</blockquote></div>