Speedup PIO Home via internal calling of PIO Core CLI

This commit is contained in:
Ivan Kravets
2019-07-01 15:55:42 +03:00
parent 500b3e08fe
commit dfca7f0b68
8 changed files with 41 additions and 31 deletions
+1 -1
View File
@@ -123,7 +123,7 @@ def cli(ctx, project_dir, project_conf, environment, verbose, interface,
if helpers.is_mi_mode(__unprocessed):
click.echo('~"Preparing firmware for debugging...\\n"')
output = helpers.GDBBytesIO()
with helpers.capture_std_streams(output):
with util.capture_std_streams(output):
helpers.predebug_project(ctx, project_dir, env_name, preload,
verbose)
output.close()
-12
View File
@@ -14,7 +14,6 @@
import sys
import time
from contextlib import contextmanager
from fnmatch import fnmatch
from hashlib import sha1
from io import BytesIO
@@ -41,17 +40,6 @@ class GDBBytesIO(BytesIO): # pylint: disable=too-few-public-methods
self.STDOUT.flush()
@contextmanager
def capture_std_streams(stdout, stderr=None):
_stdout = sys.stdout
_stderr = sys.stderr
sys.stdout = stdout
sys.stderr = stderr or stdout
yield
sys.stdout = _stdout
sys.stderr = _stderr
def is_mi_mode(args):
return "--interpreter" in " ".join(args)