BurntSushi / BurntSushi/winapi-util

Windows stdio handles can be null

Open
#11 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
74
Forks
21
PR merge metrics
No merged PRs in 30d

Description

See also: https://github.com/rust-lang/rust/issues/88576

In short, Windows stdio functions can return null to mean that there are no handles. The [code here](https://github.com/BurntSushi/winapi-util/blob/8f291c9da272b24699f31e22c521404255462642/src/win.rs#L132) assumes stdio handles are always valid `File` handles. While this is technically an incorrect assumption, it worked out ok until Rust's new "Safe I/O" code was implemented.

A workaround will be implemented upstream but I thought there should be an issue here too, since unfortunately it reached stable, causing `env_logger` to break.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with src/win.rs around line 132 and read the linked Rust issue about Windows stdio handles returning null. Trace how those handles are treated as File handles and compare the upstream workaround. Done means env_logger no longer breaks when Windows stdio functions return null.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.