[m-users.] Spawning external process

Zoltan Somogyi zoltan.somogyi at runbox.com
Sat Jul 16 23:23:44 AEST 2022


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