diff options
author | Zach White <skullydazed@gmail.com> | 2021-05-19 15:24:46 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-19 15:24:46 -0700 |
commit | db1eacdaacb9c8f6889f46bc1c6af155b81ad72a (patch) | |
tree | cd32a69a04c7ff93a11941d82aef3ce31c2b7523 /lib/python/qmk/cli/flash.py | |
parent | a9aec546c873fa5a2cb1d9a10878aca71818b609 (diff) | |
download | qmk_firmware-db1eacdaacb9c8f6889f46bc1c6af155b81ad72a.tar.gz qmk_firmware-db1eacdaacb9c8f6889f46bc1c6af155b81ad72a.zip |
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>
Diffstat (limited to 'lib/python/qmk/cli/flash.py')
-rw-r--r-- | lib/python/qmk/cli/flash.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/python/qmk/cli/flash.py b/lib/python/qmk/cli/flash.py index 1b6784061..1b2932a5b 100644 --- a/lib/python/qmk/cli/flash.py +++ b/lib/python/qmk/cli/flash.py | |||
@@ -3,6 +3,7 @@ | |||
3 | You can compile a keymap already in the repo or using a QMK Configurator export. | 3 | You can compile a keymap already in the repo or using a QMK Configurator export. |
4 | A bootloader must be specified. | 4 | A bootloader must be specified. |
5 | """ | 5 | """ |
6 | from subprocess import DEVNULL | ||
6 | 7 | ||
7 | from argcomplete.completers import FilesCompleter | 8 | from argcomplete.completers import FilesCompleter |
8 | from milc import cli | 9 | from milc import cli |
@@ -55,7 +56,7 @@ def flash(cli): | |||
55 | """ | 56 | """ |
56 | if cli.args.clean and not cli.args.filename and not cli.args.dry_run: | 57 | if cli.args.clean and not cli.args.filename and not cli.args.dry_run: |
57 | command = create_make_command(cli.config.flash.keyboard, cli.config.flash.keymap, 'clean') | 58 | command = create_make_command(cli.config.flash.keyboard, cli.config.flash.keymap, 'clean') |
58 | cli.run(command, capture_output=False) | 59 | cli.run(command, capture_output=False, stdin=DEVNULL) |
59 | 60 | ||
60 | # Build the environment vars | 61 | # Build the environment vars |
61 | envs = {} | 62 | envs = {} |
@@ -98,7 +99,7 @@ def flash(cli): | |||
98 | cli.log.info('Compiling keymap with {fg_cyan}%s', ' '.join(command)) | 99 | cli.log.info('Compiling keymap with {fg_cyan}%s', ' '.join(command)) |
99 | if not cli.args.dry_run: | 100 | if not cli.args.dry_run: |
100 | cli.echo('\n') | 101 | cli.echo('\n') |
101 | compile = cli.run(command, capture_output=False, text=True) | 102 | compile = cli.run(command, capture_output=False, stdin=DEVNULL) |
102 | return compile.returncode | 103 | return compile.returncode |
103 | 104 | ||
104 | else: | 105 | else: |