[m-users.] Spawning external process

Sean Charles (emacstheviking) objitsu at gmail.com
Sat Jul 16 23:33:18 AEST 2022


Thanks for that Zoltan, the content is on point as usual.   :)

I've just been reading the code in io. and also module_cmds.m for some background information / education and I can see that the code to handle .NET redirects to a temp. file, and I also have already experimented with redirecting using the Unix shell operators as you have pointed out. I am using 

I am writing a literate programming tool, actually it's now functional, but I thought it would be a nice feature to be able to spawn an external command and include the output into the final document stream but I think maybe I am wandering off topic with it... I'll make some notes and come back to it another day. 

Ignore my last question, it must be a broken link in the mmc-doc rendered output or something...it's not part of the stock distribution anyway.

Many thanks,
Sean.



> On 16 Jul 2022, at 14:23, Zoltan Somogyi <zoltan.somogyi at runbox.com> wrote:
> 
> 
> 2022-07-16 22:59 GMT+10:00 "Sean Charles (emacstheviking)" <objitsu at gmail.com>:
>> I've used io.call_system/4 a few times but in the comments it says that it and call_system_return_signal/4 are marked as obsolete.
>> 
>> What's the preferred method now?
> 
> It is marked obsolete with this code:
> 
> :- pragma obsolete(pred(call_system_return_signal/4),
>    [io.call_system.call_system_return_signal/4]).
> 
> That means that its replacement is io.call_system.call_system_return_signal/4,
> and any warning about the called predicate being obsolete should tell you
> this fact.
> 
> The io.m module was by far the biggest module in the Mercury system.
> So after the last release, I broke it into a bunch of smaller pieces. Many of its
> predicates are now defined in new submodules of io.m, such as io.call_system.m.
> To avoid breaking existing code, there are still forwarding predicates to them
> in io.m, but they are marked obsolete, with the suggested replacement being
> the identical predicate in the new submodule, to encourage people to add
> the additional module qualifiers, at their leasure, but sometime before the
> next release, so that at that time, we can delete the forwarding predicates.
> 
>> I wanted to be able to launch a process and capture either:
>> 
>>  - none of the  output
>>  - stdout only
>>  - stdout and stderr
> 
> The command string you pass to call_system_return_signal is given to sh,
> the standard Unix shell, which means that all its usual file redirection operations
> are available, including cmd > captured_stdout and cmd > captured_stdout_and_stderr 2>&1.
> Or did you mean something else?
> 
>> When I use www as the page viewer for mmc-doc,
> 
> I don't know what this means, so I can't help you with this part.
> 
> Zoltan.



More information about the users mailing list