Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/uv-trampoline/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ windows = { version = "0.61.0", features = [
"Win32_System_LibraryLoader",
"Win32_System_Threading",
"Win32_UI_WindowsAndMessaging",
"Win32_Storage_FileSystem",
] }
ufmt-write = "0.1.0"
ufmt = { version = "0.2.0", features = ["std"] }
Expand Down
4 changes: 4 additions & 0 deletions crates/uv-trampoline/src/bounce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use windows::Win32::{
Foundation::{
CloseHandle, HANDLE, HANDLE_FLAG_INHERIT, INVALID_HANDLE_VALUE, SetHandleInformation, TRUE,
},
Storage::FileSystem::{FILE_TYPE_PIPE, GetFileType},
System::Console::{
GetStdHandle, STD_INPUT_HANDLE, STD_OUTPUT_HANDLE, SetConsoleCtrlHandler, SetStdHandle,
},
Expand Down Expand Up @@ -345,6 +346,9 @@ fn close_handles(si: &STARTUPINFOA) {
// Unlike cleanup_standard_io(), we don't close STD_ERROR_HANDLE to retain warn!
for std_handle in [STD_INPUT_HANDLE, STD_OUTPUT_HANDLE] {
if let Ok(handle) = unsafe { GetStdHandle(std_handle) } {
if handle.is_invalid() || unsafe { GetFileType(handle) } != FILE_TYPE_PIPE {
continue;
}
unsafe { CloseHandle(handle) }.unwrap_or_else(|_| {
warn!("Failed to close standard device handle {}", handle.0 as u32);
});
Expand Down
Loading