mirror of
https://github.com/esphome/esphome.git
synced 2025-03-15 15:18:16 +00:00
Debug
This commit is contained in:
parent
2f4705e2a3
commit
4f2f7a5d68
@ -21,14 +21,15 @@ def run_platformio_cli(*args, **kwargs):
|
||||
|
||||
def strip_ansi(x):
|
||||
print("strip_ansi({})".format(x))
|
||||
return x
|
||||
|
||||
click._compat.strip_ansi = lambda x: x
|
||||
click._compat.strip_ansi = strip_ansi
|
||||
|
||||
def should_strip_ansi(stream=None, color=None):
|
||||
print("should_strip_ansi({}, {})".format(stream, color))
|
||||
return False
|
||||
|
||||
click._compat.should_strip_ansi = lambda x: False
|
||||
click._compat.should_strip_ansi = should_strip_ansi
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
print("Error: {}".format(e))
|
||||
|
||||
|
@ -57,6 +57,7 @@ class RedirectText(object):
|
||||
|
||||
# pylint: disable=no-self-use
|
||||
def isatty(self):
|
||||
print("isatty: True")
|
||||
return True
|
||||
|
||||
|
||||
@ -69,6 +70,7 @@ def run_external_command(func, *cmd, **kwargs):
|
||||
full_cmd = u' '.join(shlex_quote(x) for x in cmd)
|
||||
_LOGGER.info(u"Running: %s", full_cmd)
|
||||
|
||||
sys.stdin = RedirectText(sys.stdin)
|
||||
sys.stdout = RedirectText(sys.stdout)
|
||||
sys.stderr = RedirectText(sys.stderr)
|
||||
|
||||
@ -91,6 +93,8 @@ def run_external_command(func, *cmd, **kwargs):
|
||||
sys.argv = orig_argv
|
||||
sys.exit = orig_exit
|
||||
|
||||
if isinstance(sys.stdin, RedirectText):
|
||||
sys.stdin = sys.__stdin__
|
||||
if isinstance(sys.stdout, RedirectText):
|
||||
sys.stdout = sys.__stdout__
|
||||
if isinstance(sys.stderr, RedirectText):
|
||||
|
Loading…
x
Reference in New Issue
Block a user