

Consistently present absent stdio handles on Windows as NULL handles. by sunfish...
source link: https://github.com/rust-lang/rust/pull/93263
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

This addresses #90964 by making the std API consistent about presenting
absent stdio handles on Windows as NULL handles. Stdio handles may be
absent due to #![windows_subsystem = "windows"]
, due to the console
being detached, or due to a child process having been launched from a
parent where stdio handles are absent.
Specifically, this fixes the case of child processes of parents with absent
stdio, which previously ended up with stdin().as_raw_handle()
returningINVALID_HANDLE_VALUE
, which was surprising, and which overlapped with an
unrelated valid handle value. With this patch, stdin().as_raw_handle()
now returns null in these situation, which is consistent with what it
does in the parent process.
And, document this in the "Windows Portability Considerations" sections of
the relevant documentation.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK