diff --git a/README b/README index fe895af..dabe1f9 100644 --- a/README +++ b/README @@ -30,8 +30,9 @@ BTest has the following prerequisites: - Python version >= 3.7 (older versions may work, but are not well-tested). -- Bash (note that on FreeBSD and Alpine Linux, bash is not installed - by default). +- Bash. Note that on FreeBSD and Alpine Linux, bash is not installed by + default. This is also required on Windows, in the form of Git's msys2, Cygwin, + etc. BTest has the following optional prerequisites to enable additional functionality: @@ -41,6 +42,20 @@ functionality: - perf (Linux only). Note that on Debian/Ubuntu, you also need to install the "linux-tools" package. +Windows Caveats +--------------- + +When running BTest on Windows, you must have a bash shell installed of some +sort. This can be from WSL, Cygwin, msys2, Git, or any number of other methods, +but ``bash.exe`` must be available. BTest will check for its existence at +startup and exit if it is not available. + +A minor change must be made to any configuration value that is a path list. For +example, if you are setting the ``PATH`` environment variable from your +btest.cfg. In these cases, you should use ``$(pathsep)s`` in the configuration +instead of bare ``:`` or ``;`` values to separate the paths. This ensures that +both POSIX and Windows systems handle the path lists correctly. + Download and Installation ========================= diff --git a/btest b/btest index ad6b15b..b24c25b 100755 --- a/btest +++ b/btest @@ -2790,7 +2790,22 @@ if __name__ == '__main__': pyver_min = sys.version_info[1] if sys.platform == 'win32': + # The "fork" method doesn't exist at all on Windows, so force over to + # "spawn" instead. mp.set_start_method('spawn') + + # Double-check that `bash.exe` exists and is executable, since it's + # required for pretty much anything here to work on Windows. Note we're + # doing this prior to parsing the config file because it's required for + # backtick-expansion there as well. + try: + subprocess.call(['bash.exe', '--version'], + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL) + except FileNotFoundError: + print("error: bash.exe is required to be in your PATH to run BTest.", file=sys.stderr) + sys.exit(1) + elif (pyver_maj == 3 and pyver_min >= 8) or pyver_maj > 3: mp.set_start_method('fork')