Run pre-commit
This commit is contained in:
parent
69d333ff9b
commit
8a15f4f5d7
3 changed files with 10 additions and 6 deletions
|
|
@ -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
12
test.py
|
|
@ -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()
|
||||
|
|
|
|||
1
test.sh
1
test.sh
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue