| Did you know ... | Search Documentation: |
| Running a child process on a Windows terminal |
A child process gets a terminal on Windows by attaching to a pseudo console. The Epilog window (see swipl-win.exe) has no console of its own: it talks to its Prolog thread over two pipes, and a child handed those has nothing that echoes what it reads, no window size and no way to be interrupted. The functions below put such a child on the console of the terminal behind a stream. This is what shell/1 does, and what process_create/3 does for the streams the caller left alone. They exist on Windows only.
NULL if it has none to give. This is a claim rather than a
query: the console reads and writes the same pipe ends as the stream, so
the terminal runs one only while a client holds it, and the holder must
touch neither the stream nor its companions meanwhile. Declared
HANDLE because HPCON postdates SWI-Stream.h;
they are the same.NULL if it cannot be built. Pass it as the
lpAttributeList of a STARTUPINFOEXW and create
the process with EXTENDED_STARTUPINFO_PRESENT. Not with
CREATE_NO_WINDOW: that asks for a console of the child's
own, which is the opposite of what the attribute says and wins.