Run pre-commit

This commit is contained in:
Melissa LeBlanc-Williams 2022-11-10 12:45:10 -08:00
parent 69d333ff9b
commit 8a15f4f5d7
3 changed files with 10 additions and 6 deletions

View file

@ -69,6 +69,7 @@ class Shell:
"""
Run a shell command and show the output as it runs
"""
def read_stream(output):
fd = output.fileno()
fl = fcntl.fcntl(fd, fcntl.F_GETFL)
@ -84,7 +85,7 @@ class Shell:
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
universal_newlines=True
universal_newlines=True,
) as proc:
while proc.poll() is None:
err = read_stream(proc.stderr)

12
test.py
View file

@ -1,16 +1,20 @@
try:
from adafruit_shell import Shell
except ImportError:
raise RuntimeError("The library 'adafruit_shell' was not found. To install, try typing: sudo pip3 install adafruit-python-shell")
raise RuntimeError(
"The library 'adafruit_shell' was not found. To install, try typing: sudo pip3 install adafruit-python-shell"
)
shell = Shell()
shell.group="Blinka"
shell.group = "Blinka"
def main():
#shell.clear()
# shell.clear()
print("Running test")
shell.run_command("./test.sh")
# Main function
if __name__ == "__main__":
main()
main()

View file

@ -4,4 +4,3 @@ echo Interactive Test
>&2 echo This should also go to stderr
read -p "Hello, who am I speaking to? " NAME
echo It\'s Nice to meet you $NAME