Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Run test fixture scripts on Windows with Git Bash
Previously they had run on Windows with whatever `bash` was found in a `PATH` search, which had two problems: - On most, but not all, Windows systems, except when running in a specialized environment such as a Git Bash shell where `PATH` is changed, the `System32` directory contains a `bash.exe` program associated with WSL (that attempts to use WSL to run `bash` in an installed distrobution) and appears in the value of `PATH` before any other directory that contains a `bash.exe` program. This makes it so that, on most Windows systems, it has been necessary to run the test suite from Git Bash or another MSYS2 environment, or otherwise to adjust the `PATH`. - That adjusting the path, even by using a Git Bash environment is *sufficient* to work around this on most Windows systems relies on non-guaranteed behavior of `std::process::Command` executable search, which may change without warning in the future. On Windows, the usual `CreateProcessW` path search behavior actually searches various locations before examining `PATH` directories, and the `System32` directory is one of these. To avoid including the current directory in the search, `std::process::Command` does its own search, which is otherwise mostly similar to how `CreateProcessW` searches. But one other way it differs, which is subject to change, is that whenever any environment variable is set, it first searches the directories in (what will be) the child environment. If in the future this is not done, or narrowed to be done only when `PATH` is one of the environment variables customized for the child process, then putting the directory with the desired `bash.exe` earlier than the `System32` directory in `PATH` will no longer prevent `std::proces::Command` from finding the `bash.exe` in `System32` as `CreateProcessW` would and using it. Then it would be nontrivial to run the test suite on Windows.
- Loading branch information