Invoke sh exe directly on windows

It seems like the bots don't know how to run sh files, so we need to
run the executable directly.

Bug: 407563488
Change-Id: I9199bbcd4a4ddabf9438fc44b0d9e84e952d154a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6922754
Auto-Submit: Devon Loehr <dloehr@google.com>
Commit-Queue: Arthur Eubanks <aeubanks@google.com>
Commit-Queue: Devon Loehr <dloehr@google.com>
Reviewed-by: Arthur Eubanks <aeubanks@google.com>
Cr-Commit-Position: refs/heads/main@{#1512655}
NOKEYCHECK=True
GitOrigin-RevId: e7308b9bf7d143fb07f9b1a69b1a4f4e7f0598a8
diff --git a/build_rust.py b/build_rust.py
index f8de660..599a0bc 100755
--- a/build_rust.py
+++ b/build_rust.py
@@ -255,17 +255,27 @@
 
 
 def InstallBetaPackage(package_dir, install_dir):
+    cmd = []
     if sys.platform == 'win32':
         # The install scripts on windows require relative, posix-style paths.
         install_dir = os.path.relpath(install_dir).replace('\\', '/')
-    args = [
+        # Windows might get confused on how to run an sh file if we don't
+        # invoke the executable directly
+        where = subprocess.check_output(['where.exe', 'sh'], text=True)
+        sh_exe = where.splitlines()[0]
+        cmd += [sh_exe]
+
+    cmd += [
+        os.path.join(package_dir, 'install.sh'),
         f'--destdir={install_dir}',
         f'--prefix=',
     ]
+
     if sys.platform.startswith('linux'):
         # Avoid warnings due to not running as root.
-        args += ['--disable-ldconfig']
-    RunCommand([os.path.join(package_dir, 'install.sh')] + args)
+        cmd += ['--disable-ldconfig']
+
+    RunCommand(cmd)
 
 
 def VendorForStdlib(cargo_bin):