Skip to content

Commit f01fdfa

Browse files
committed
Enforce using the right bash.exe on Windows
1 parent 9ab2c72 commit f01fdfa

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

btest

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,10 @@ def _build_win_subprocess_cmd_script(cmd, tmpdir=None):
228228
tf.write(fcontents)
229229
tf.flush()
230230

231-
bash_cmd = ["bash.exe", "-c", normalize_path(tf.name)]
231+
# If you have Windows 11 and WSL2, it defaults to calling "Microsoft Bash Launcher"
232+
# even if gitbash is in your path first. Who knows why. Using shutil.which here
233+
# forces it to call the right thing.
234+
bash_cmd = [shutil.which("bash.exe"), "-c", normalize_path(tf.name)]
232235
return tf, bash_cmd
233236

234237

0 commit comments

Comments
 (0)