rust/library/std/src/sys
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
..
alloc Apply rustc-0023-Add-Trusty-OS-support-to-Rust-std.patch 2025-03-10 10:00:24 -07:00
anonymous_pipe Mv os-specific trait impl of Pipe* into std::os::* 2025-03-14 01:03:56 +11:00
args Unify owned Args types between platforms 2025-04-12 05:11:27 -07:00
fd std: Fix build for NuttX targets 2025-04-05 12:05:43 -07:00
fs Rollup merge of #139683 - ChrisDenton:windows-with-native, r=tgross35,joboet 2025-04-13 11:48:18 +00:00
io Trusty: Implement write_vectored for stdio 2025-03-27 16:49:30 -07:00
net std: Fix build for NuttX targets 2025-04-05 12:05:43 -07:00
os_str Specialize OsString::push for strings 2025-02-28 13:42:31 -08:00
pal Rollup merge of #139710 - thaliaarchi:move-args-pal, r=joboet 2025-04-13 11:48:19 +00:00
path Use with_native_path for Windows 2025-04-11 18:02:03 +00:00
personality Rollup merge of #137621 - Berrysoft:cygwin-std, r=joboet 2025-03-17 05:47:49 -04:00
process Rollup merge of #139517 - Ayush1325:uefi-cmd-stdin-null, r=joboet 2025-04-15 15:47:25 +10:00
random Change the syntax of the internal weak! macro 2025-03-26 16:25:05 +01:00
stdio Rollup merge of #139517 - Ayush1325:uefi-cmd-stdin-null, r=joboet 2025-04-15 15:47:25 +10:00
sync Fix *-win7-windows-msvc target since 26eeac1a1e 2025-02-19 18:05:37 +08:00
thread_local Rollup merge of #139121 - thaliaarchi:rename-thread_local-statik, r=Noratrieb 2025-04-05 19:40:24 +02:00
backtrace.rs Improve comments for the default backtrace printer 2024-12-04 20:54:37 -05:00
cmath.rs std: make cmath functions safe 2025-03-29 13:08:18 +01:00
exit_guard.rs Attempt to fix CI 2024-07-08 09:19:25 -05:00
mod.rs Move args into std::sys 2025-04-12 03:10:21 -07:00