CLI: Fix 'cd' subcommand on Windows (#16610)

The 'cd' subcommand was failing as the current shell's Windows path was
mangled while milc processed it.
Using 'subprocess' directly avoids this issue and an extra layer of
subshell.
This commit is contained in:
Erovia 2022-03-10 21:33:41 +00:00 committed by GitHub
parent 6c40b6856b
commit b75f6691a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,6 +2,7 @@
""" """
import sys import sys
import os import os
import subprocess
from milc import cli from milc import cli
@ -41,6 +42,6 @@ def cd(cli):
# Set the prompt for the new shell # Set the prompt for the new shell
qmk_env['MSYS2_PS1'] = qmk_env['PS1'] qmk_env['MSYS2_PS1'] = qmk_env['PS1']
# Start the new subshell # Start the new subshell
cli.run([os.environ.get('SHELL', '/usr/bin/bash')], env=qmk_env) subprocess.run([os.environ.get('SHELL', '/usr/bin/bash')], env=qmk_env)
else: else:
cli.log.info("Already within qmk_firmware directory.") cli.log.info("Already within qmk_firmware directory.")