softprops / atty

are you or are you not a tty?
MIT License
271 stars 48 forks source link

Fix msys detection with new winapi. #28

Closed ehuss closed 5 years ago

ehuss commented 5 years ago

Ever since winapi version 0.3.5, tty detection for msys terminals has been broken. The definition for FILE_NAME_INFO struct changed in retep998/winapi-rs#607, causing the first character from the filename to be cut off.

BurntSushi commented 5 years ago

Nice fix! I think I buy it. @retep998 Was this sort of breakage intentional? Or was the way we were using FILE_NAME_INFO previously just flat out wrong?

BurntSushi commented 5 years ago

Also, does this fix work with winapi >=0.3.0, <0.3.5?

retep998 commented 5 years ago

That sort of breakage was not intentional, but it's also the sort of breakage that should not affect anyone because people should not be assuming that the offset of the unsized field is the same as the struct's size. The new code in this PR is definitely much better. Yes, it works with all winapi versions.

ehuss commented 5 years ago

Also, does this fix work with winapi >=0.3.0, <0.3.5?

I tested with winapi 0.3.0 on a variety of windows shells, and they all seem to behave correctly.

softprops commented 5 years ago

Thank you folks!

softprops commented 5 years ago

@retep998 @BurntSushi I tagged and published a new crate version 0.2.11

BurntSushi commented 5 years ago

@softprops Awesome, thank you!