Created
November 23, 2020 16:48
-
-
Save apatard/d8ba985b9f48ba908057a726549dbbc2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import os | |
from enrich.console import Console | |
def should_do_markup(): | |
"""Decide about use of ANSI colors.""" | |
term = os.environ.get("TERM", "") | |
if "xterm" in term: | |
return True | |
if term == "dumb": | |
return False | |
return sys.stdout.isatty() | |
console = Console( | |
force_terminal=should_do_markup(), record=True, redirect=True | |
) | |
print("1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111") | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
out=subprocess.run(['python3', './console.py'], stdout=subprocess.PIPE, text=True) | |
print("{}\n".format(out.stdout)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment