From 0edcb106e915b6f7fe876a02a9639d8ee901e1d3 Mon Sep 17 00:00:00 2001
From: Ray Kraesig <rkraesig@mozilla.com>
Date: Thu, 27 Oct 2022 00:10:45 +0000
Subject: [PATCH] Bug 1797399 - fix rust-analyzer's invocation of mach  r=andi

The fix for bug 1759555 involves having rust-analyzer invoke `mach`.
However, `mach` can't be executed directly on Windows systems -- it's a
Python script, not an executable, and so `::CreateProcessW` has no idea
what to do with it.

Work around this by having `mach` explicitly direct `rust-analyzer` to
use `sys.executable` to execute `mach`.

Differential Revision: https://phabricator.services.mozilla.com/D160306
---
 python/mozbuild/mozbuild/backend/mach_commands.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/python/mozbuild/mozbuild/backend/mach_commands.py b/python/mozbuild/mozbuild/backend/mach_commands.py
index b34a497fe473d..9a2695b7425ca 100644
--- a/python/mozbuild/mozbuild/backend/mach_commands.py
+++ b/python/mozbuild/mozbuild/backend/mach_commands.py
@@ -8,6 +8,7 @@ import argparse
 import logging
 import os
 import subprocess
+import sys
 
 from mozbuild import build_commands
 
@@ -166,6 +167,7 @@ def setup_vscode(command_context, vscode_cmd):
     clang_tidy_cfg = ClangTidyConfig(command_context.topsrcdir)
 
     cargo_check_command = [
+        sys.executable,
         mozpath.join(command_context.topsrcdir, "mach"),
         "--log-no-times",
         "cargo",
-- 
GitLab