From db1eacdaacb9c8f6889f46bc1c6af155b81ad72a Mon Sep 17 00:00:00 2001
From: Zach White <skullydazed@gmail.com>
Date: Wed, 19 May 2021 15:24:46 -0700
Subject: Align our subprocess usage with current best practices. (#12940)

* Align our subprocess usage with current best practices.

* remove unused import

* Apply suggestions from code review

Co-authored-by: Ryan <fauxpark@gmail.com>

* fix the cpp invocation for older python

* allow for unprompted installation

* make sure qmk new-keyboard works on windows

Co-authored-by: Ryan <fauxpark@gmail.com>
---
 lib/python/qmk/cli/generate/docs.py | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

(limited to 'lib/python/qmk/cli/generate/docs.py')

diff --git a/lib/python/qmk/cli/generate/docs.py b/lib/python/qmk/cli/generate/docs.py
index a59a24db50..749336fea5 100644
--- a/lib/python/qmk/cli/generate/docs.py
+++ b/lib/python/qmk/cli/generate/docs.py
@@ -1,8 +1,8 @@
 """Build QMK documentation locally
 """
 import shutil
-import subprocess
 from pathlib import Path
+from subprocess import DEVNULL
 
 from milc import cli
 
@@ -24,14 +24,16 @@ def generate_docs(cli):
     shutil.copytree(DOCS_PATH, BUILD_PATH)
 
     # When not verbose we want to hide all output
-    args = {'check': True}
-    if not cli.args.verbose:
-        args.update({'stdout': subprocess.DEVNULL, 'stderr': subprocess.STDOUT})
+    args = {
+        'capture_output': False if cli.config.general.verbose else True,
+        'check': True,
+        'stdin': DEVNULL,
+    }
 
     cli.log.info('Generating internal docs...')
 
     # Generate internal docs
-    subprocess.run(['doxygen', 'Doxyfile'], **args)
-    subprocess.run(['moxygen', '-q', '-a', '-g', '-o', BUILD_PATH / 'internals_%s.md', 'doxygen/xml'], **args)
+    cli.run(['doxygen', 'Doxyfile'], **args)
+    cli.run(['moxygen', '-q', '-a', '-g', '-o', BUILD_PATH / 'internals_%s.md', 'doxygen/xml'], **args)
 
     cli.log.info('Successfully generated internal docs to %s.', BUILD_PATH)
-- 
cgit v1.2.3