Skip to content

Windows stdio doesn't re-read GetStdHandle values #40490

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
alexcrichton opened this issue Mar 13, 2017 · 1 comment
Closed

Windows stdio doesn't re-read GetStdHandle values #40490

alexcrichton opened this issue Mar 13, 2017 · 1 comment
Labels
O-windows Operating system: Windows T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@alexcrichton
Copy link
Member

Over time the value of GetStdHandle may change (e.g. see mozilla/sccache#80) and we should likely reload the value over time instead of caching the return value to catch cases like this.

@alexcrichton alexcrichton added A-libs O-windows Operating system: Windows labels Mar 13, 2017
@retep998
Copy link
Member

retep998 commented Mar 13, 2017

There's very little value in caching the result. GetStdHandle takes 3 nanoseconds for me according to a quick bench.

alexcrichton added a commit to alexcrichton/rust that referenced this issue Mar 23, 2017
This alters the stdio code on Windows to always call `GetStdHandle` whenever the
stdio read/write functions are called as this allows us to track changes to the
value over time (such as if a process calls `SetStdHandle` while it's running).

Closes rust-lang#40490
@steveklabnik steveklabnik added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. and removed A-libs labels Mar 24, 2017
alexcrichton added a commit to alexcrichton/rust that referenced this issue Mar 25, 2017
…uron

std: Don't cache stdio handles on Windows

This alters the stdio code on Windows to always call `GetStdHandle` whenever the
stdio read/write functions are called as this allows us to track changes to the
value over time (such as if a process calls `SetStdHandle` while it's running).

Closes rust-lang#40490
bors added a commit that referenced this issue Mar 26, 2017
std: Don't cache stdio handles on Windows

This alters the stdio code on Windows to always call `GetStdHandle` whenever the
stdio read/write functions are called as this allows us to track changes to the
value over time (such as if a process calls `SetStdHandle` while it's running).

Closes #40490
bors added a commit that referenced this issue Mar 27, 2017
std: Don't cache stdio handles on Windows

This alters the stdio code on Windows to always call `GetStdHandle` whenever the
stdio read/write functions are called as this allows us to track changes to the
value over time (such as if a process calls `SetStdHandle` while it's running).

Closes #40490
alexcrichton added a commit to alexcrichton/rust that referenced this issue Mar 27, 2017
…uron

std: Don't cache stdio handles on Windows

This alters the stdio code on Windows to always call `GetStdHandle` whenever the
stdio read/write functions are called as this allows us to track changes to the
value over time (such as if a process calls `SetStdHandle` while it's running).

Closes rust-lang#40490
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
O-windows Operating system: Windows T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants