rust/library/std/src/sys/stdio
Stuart Cook 46b197ad3b
Rollup merge of #139517 - Ayush1325:uefi-cmd-stdin-null, r=joboet
std: sys: process: uefi: Use NULL stdin by default

According to the docs in `Command::output`:

> By default, stdout and stderr are captured (and used to provide the
resulting output). Stdin is not inherited from the parent and any attempt by the child process to read from the stdin stream will result in the stream immediately closing.

This was being violated by UEFI which was inheriting stdin by default.

While the docs don't explicitly state that the default should be NULL, the behaviour seems like reading from NULL.

UEFI however, has a bit of a problem. The `EFI_SIMPLE_TEXT_INPUT_PROTOCOL` only provides support for reading 1 key press. This means that you either get an error, or it is assumed that the keypress was read successfully. So there is no way to have a successful read of length 0. Currently, I am returning UNSUPPORTED error when trying to read from NULL stdin. On linux however, you will get a read of length 0 for Null stdin.

One possible way to get around this is to translate one of the UEFI errors to a read 0 (Maybe unsupported?). It is also possible to have a non-standard error code, but well, not sure if we go that route.

Alternatively, if meaning of Stdio::Null is platform dependent, it should be fine to keep the current behaviour of returning an error.

cc ```@nicholasbishop``` ```@dvdhrm```
2025-04-15 15:47:25 +10:00
..
windows std: move stdio to sys 2025-03-09 23:42:13 +01:00
mod.rs Update Trusty support to account for recent libstd reorganization 2025-03-10 12:54:59 -07:00
sgx.rs Auto merge of #136769 - thaliaarchi:io-optional-methods/stdio, r=joboet 2025-03-23 06:23:51 +00:00
solid.rs Deduplicate platform stdio types 2025-03-11 14:00:08 -07:00
teeos.rs Deduplicate platform stdio types 2025-03-11 14:00:08 -07:00
trusty.rs Trusty: Implement write_vectored for stdio 2025-03-27 16:49:30 -07:00
uefi.rs std: sys: stdio: uefi: Tread UNSUPPORTED Status as read(0) 2025-04-13 23:22:59 +05:30
unix.rs Auto merge of #136769 - thaliaarchi:io-optional-methods/stdio, r=joboet 2025-03-23 06:23:51 +00:00
unsupported.rs Implement optional methods for unsupported stdio 2025-03-22 01:21:23 -07:00
wasi.rs Move fd into sys 2025-04-04 20:11:08 -07:00
windows.rs std: move stdio to sys 2025-03-09 23:42:13 +01:00
xous.rs Deduplicate platform stdio types 2025-03-11 14:00:08 -07:00
zkvm.rs std: move stdio to sys 2025-03-09 23:42:13 +01:00