mirror of
https://github.com/esphome/esphome.git
synced 2025-03-15 07:08:20 +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):
|
def strip_ansi(x):
|
||||||
print("strip_ansi({})".format(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):
|
def should_strip_ansi(stream=None, color=None):
|
||||||
print("should_strip_ansi({}, {})".format(stream, color))
|
print("should_strip_ansi({}, {})".format(stream, color))
|
||||||
return False
|
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
|
except Exception as e: # pylint: disable=broad-except
|
||||||
print("Error: {}".format(e))
|
print("Error: {}".format(e))
|
||||||
|
|
||||||
|
@ -57,6 +57,7 @@ class RedirectText(object):
|
|||||||
|
|
||||||
# pylint: disable=no-self-use
|
# pylint: disable=no-self-use
|
||||||
def isatty(self):
|
def isatty(self):
|
||||||
|
print("isatty: True")
|
||||||
return 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)
|
full_cmd = u' '.join(shlex_quote(x) for x in cmd)
|
||||||
_LOGGER.info(u"Running: %s", full_cmd)
|
_LOGGER.info(u"Running: %s", full_cmd)
|
||||||
|
|
||||||
|
sys.stdin = RedirectText(sys.stdin)
|
||||||
sys.stdout = RedirectText(sys.stdout)
|
sys.stdout = RedirectText(sys.stdout)
|
||||||
sys.stderr = RedirectText(sys.stderr)
|
sys.stderr = RedirectText(sys.stderr)
|
||||||
|
|
||||||
@ -91,6 +93,8 @@ def run_external_command(func, *cmd, **kwargs):
|
|||||||
sys.argv = orig_argv
|
sys.argv = orig_argv
|
||||||
sys.exit = orig_exit
|
sys.exit = orig_exit
|
||||||
|
|
||||||
|
if isinstance(sys.stdin, RedirectText):
|
||||||
|
sys.stdin = sys.__stdin__
|
||||||
if isinstance(sys.stdout, RedirectText):
|
if isinstance(sys.stdout, RedirectText):
|
||||||
sys.stdout = sys.__stdout__
|
sys.stdout = sys.__stdout__
|
||||||
if isinstance(sys.stderr, RedirectText):
|
if isinstance(sys.stderr, RedirectText):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user