summaryrefslogtreecommitdiff
path: root/lib/python/qmk/commands.py
diff options
context:
space:
mode:
authorZach White <skullydazed@gmail.com>2021-05-19 15:49:11 -0700
committerZach White <skullydazed@gmail.com>2021-05-19 15:49:11 -0700
commit6955c5a00295382d3b4151a840aa5c929cd98059 (patch)
tree26109c4ed2a266650fc5fad19ce5f784bc7c346b /lib/python/qmk/commands.py
parent82aa9ad4a567695d1f7d0b1e36bf8563d2967813 (diff)
parentdb1eacdaacb9c8f6889f46bc1c6af155b81ad72a (diff)
Merge remote-tracking branch 'origin/master' into develop
Resolved Conflicts: lib/python/qmk/tests/test_cli_commands.py util/install/fedora.sh
Diffstat (limited to 'lib/python/qmk/commands.py')
-rw-r--r--lib/python/qmk/commands.py23
1 files changed, 2 insertions, 21 deletions
diff --git a/lib/python/qmk/commands.py b/lib/python/qmk/commands.py
index 99461db325..3a35c11031 100644
--- a/lib/python/qmk/commands.py
+++ b/lib/python/qmk/commands.py
@@ -2,11 +2,9 @@
"""
import json
import os
-import platform
-import subprocess
-import shlex
import shutil
from pathlib import Path
+from subprocess import DEVNULL
from time import strftime
from milc import cli
@@ -94,7 +92,7 @@ def get_git_version(repo_dir='.', check_dir='.'):
git_describe_cmd = ['git', 'describe', '--abbrev=6', '--dirty', '--always', '--tags']
if Path(check_dir).exists():
- git_describe = cli.run(git_describe_cmd, cwd=repo_dir)
+ git_describe = cli.run(git_describe_cmd, stdin=DEVNULL, cwd=repo_dir)
if git_describe.returncode == 0:
return git_describe.stdout.strip()
@@ -225,20 +223,3 @@ def parse_configurator_json(configurator_file):
user_keymap['layout'] = aliases[orig_keyboard]['layouts'][user_keymap['layout']]
return user_keymap
-
-
-def run(command, *args, **kwargs):
- """Run a command with subprocess.run
- """
- platform_id = platform.platform().lower()
-
- if isinstance(command, str):
- raise TypeError('`command` must be a non-text sequence such as list or tuple.')
-
- if 'windows' in platform_id:
- safecmd = map(str, command)
- safecmd = map(shlex.quote, safecmd)
- safecmd = ' '.join(safecmd)
- command = [os.environ.get('SHELL', '/usr/bin/bash'), '-c', safecmd]
-
- return subprocess.run(command, *args, **kwargs)