<html><head></head><body><div>Am Samstag, dem 31.08.2024 um 18:10 +0100 schrieb emacstheviking:</div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><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></blockquote><div><br></div><div>Maybe you're right. Anyhow, there should be a possibility to attach a stream to an existing file descriptor. So something like this can be implemented. It restricts what can be done with streams, when this isn't provided.</div><div><br></div><div>Volker</div><div><br></div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div dir="ltr"><div><br></div><div><br></div></div><div><br></div><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 type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div>Hi there<br></div><div><br>Actually, I've been toying with the idea of writing something like this:<br></div><div><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></div><div><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></div><div><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></div><div><br>Cheers<br>Volker<br></div><div><br></div><div><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.</div><div><br></div></blockquote></div></blockquote><div><br></div><div><span></span></div></body></html>