softprops / atty

are you or are you not a tty?
MIT License
277 stars 50 forks source link

Fix msys detection with new winapi. #28

Closed ehuss closed 6 years ago

ehuss commented 6 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 6 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 6 years ago

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

retep998 commented 6 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 6 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 6 years ago

Thank you folks!

softprops commented 6 years ago

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

BurntSushi commented 6 years ago

@softprops Awesome, thank you!