From c04c160b5484a5587345d3e1eca0c43fae9260f5 Mon Sep 17 00:00:00 2001 From: Kevin Van Brunt Date: Mon, 11 Nov 2019 10:34:02 -0500 Subject: Fix bug where cmd2 ran 'stty sane' command when stdin was not a terminal --- CHANGELOG.md | 1 + cmd2/cmd2.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8492b687..a5a5725e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ * Bug Fixes * Fixed bug where setting `use_ipython` to False removed ipy command from the entire `cmd2.Cmd` class instead of just the instance being created + * Fix bug where cmd2 ran 'stty sane' command when stdin was not a terminal * Enhancements * Send all startup script paths to run_script. Previously we didn't do this if the file was empty, but that showed no record of the run_script command in history. diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index 23f45024..e50d9512 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -1607,7 +1607,7 @@ class Cmd(cmd.Cmd): """Run the command finalization hooks""" with self.sigint_protection: - if not sys.platform.startswith('win') and self.stdout.isatty(): + if not sys.platform.startswith('win') and self.stdin.isatty(): # Before the next command runs, fix any terminal problems like those # caused by certain binary characters having been printed to it. import subprocess -- cgit v1.2.1