Bug 1815799 - Fix fzf preview on Windows. r=firefox-build-system-reviewers,ahochheiden

fzf doesn't quote the preview command arguments, so if you have
windows-style paths given to a unix-style shell, the slashes are
completely gone.

This happens on multiple systems, both with MozillaBuild and external
MSYS2 shell.

fzf respects the SHELL environment variable, so to fix it, execute the
command using cmd.exe on Windows, via $COMSPEC.

Depends on D169264

Differential Revision: https://phabricator.services.mozilla.com/D169265
This commit is contained in:
Emilio Cobos Álvarez 2023-02-09 01:12:12 +00:00
parent 503554894e
commit b0c0bff90b

View File

@ -330,6 +330,11 @@ def run_fzf(cmd, tasks):
env.update(
{"PYTHONPATH": os.pathsep.join([p for p in sys.path if "requests" in p])}
)
# Make sure fzf uses Windows' shell rather than MozillaBuild bash or
# whatever our caller uses, since it doesn't quote the arguments properly
# and thus windows paths like: C:\moz\foo end up as C:mozfoo...
if platform.system() == "Windows":
env["SHELL"] = env["COMSPEC"]
proc = subprocess.Popen(
cmd,
stdout=subprocess.PIPE,