You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Avoid truncating the path to the test executable on Windows. (#724)
On Windows, we get the path to the (current) test executable by calling
`GetModuleFileNameW()`. This function has odd behaviour when the input
buffer is too short. Rather than returning `false` or `-1` or some such,
as you might expect, it returns successfully but truncates the path (and
null-terminates while doing so.)
The function _does_ set the last error in this case to
`ERROR_INSUFFICIENT_BUFFER`, indicating we need a larger buffer. (The
error behaviour on Windows XP is different, but we don't support Windows
XP. If you decide to add support for Windows XP to Swift Testing, keep
this in mind.)
So this PR checks for `ERROR_INSUFFICIENT_BUFFER` and loops with a
larger buffer, similar to what we do on Darwin.
### Checklist:
- [x] Code and documentation should follow the style of the [Style
Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
- [x] If public symbols are renamed or modified, DocC references should
be updated.
0 commit comments