Function std::sys::windows::pipe::anon_pipe

source ·
pub fn anon_pipe(
    ours_readable: bool,
    their_handle_inheritable: bool
) -> Result<Pipes>
Expand description

Although this looks similar to anon_pipe in the Unix module it’s actually subtly different. Here we’ll return two pipes in the Pipes return value, but one is intended for “us” where as the other is intended for “someone else”.

Currently the only use case for this function is pipes for stdio on processes in the standard library, so “ours” is the one that’ll stay in our process whereas “theirs” will be inherited to a child.

The ours/theirs pipes are not specifically readable or writable. Each one only supports a read or a write, but which is which depends on the boolean flag given. If ours_readable is true, then ours is readable and theirs is writable. Conversely, if ours_readable is false, then ours is writable and theirs is readable.

Also note that the ours pipe is always a handle opened up in overlapped mode. This means that technically speaking it should only ever be used with OVERLAPPED instances, but also works out ok if it’s only ever used once at a time (which we do indeed guarantee).