summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJared Crapo <jared@kotfu.net>2017-08-23 14:33:13 -0600
committerJared Crapo <jared@kotfu.net>2017-08-23 14:33:13 -0600
commit64e19334cf6aac8edeecf8e7f8725d00da758ee5 (patch)
tree8da3b45dbbae84f7a532790ad8b239181441c098
parentba1319f22f9e116a12d525d8d1d50cfe6318db4c (diff)
downloadcmd2-git-64e19334cf6aac8edeecf8e7f8725d00da758ee5.tar.gz
Don’t try and sane the tty if stdin isn’t a tty
-rwxr-xr-xcmd2.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/cmd2.py b/cmd2.py
index d22ce41c..2b99a7ab 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -717,8 +717,9 @@ class Cmd(cmd.Cmd):
"""
if not sys.platform.startswith('win'):
# Fix those annoying problems that occur with terminal programs like "less" when you pipe to them
- proc = subprocess.Popen(shlex.split('stty sane'))
- proc.communicate()
+ if self.stdin.isatty():
+ proc = subprocess.Popen(shlex.split('stty sane'))
+ proc.communicate()
return stop
def parseline(self, line):