sanitycheck: leave non-tty terminal unmodified on exit

The terminal configuration should not be reset on exit if
sanitycheck's output is being directed to something that mediates the
terminal control, such as a pager.  Only do the reset if stdout is
interactive.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
Peter Bigot 2020-01-26 05:35:40 -06:00 committed by Carles Cufí
commit ab7773dae8

View file

@ -4365,4 +4365,5 @@ if __name__ == "__main__":
try:
main()
finally:
os.system("stty sane")
if os.isatty(1): # stdout is interactive
os.system("stty sane")